Skip to content

Commit afcf7a7

Browse files
committed
Revert missing section
1 parent 6f6760d commit afcf7a7

File tree

1 file changed

+44
-18
lines changed

1 file changed

+44
-18
lines changed

README.md

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,50 @@ Or version and architecture:
111111
);
112112

113113
### If you want use your own implementation you need to create driver config and use it for set up(ex get, setup and work with phantomjs driver from taobao mirror):
114+
public class TaobaoPhantomConfig : IDriverConfig
115+
{
116+
public string GetName()
117+
{
118+
return "TaobaoPhantom";
119+
}
120+
121+
public string GetUrl32()
122+
{
123+
return "https://npm.taobao.org/mirrors/phantomjs/phantomjs-<version>-windows.zip";
124+
}
125+
126+
public string GetUrl64()
127+
{
128+
return GetUrl32();
129+
}
130+
131+
public string GetBinaryName()
132+
{
133+
return "phantomjs.exe";
134+
}
135+
136+
public string GetLatestVersion()
137+
{
138+
using (var client = new WebClient())
139+
{
140+
var doc = new HtmlDocument();
141+
var htmlCode = client.DownloadString("https://bitbucket.org/ariya/phantomjs/downloads");
142+
doc.LoadHtml(htmlCode);
143+
var itemList =
144+
doc.DocumentNode.SelectNodes("//tr[@class='iterable-item']/td[@class='name']/a")
145+
.Select(p => p.InnerText)
146+
.ToList();
147+
var version = itemList.FirstOrDefault()?.Split('-')[1];
148+
return version;
149+
}
150+
}
151+
}
152+
153+
...
154+
155+
new DriverManager().SetUpDriver(new TaobaoPhantomConfig());
156+
157+
### Also you can implement your own services for download binaries and manage variables:
114158
public class CustomBinaryService : IBinaryService
115159
{
116160
public string SetupBinary(string url, string zipDestination, string binDestination, string binaryName)
@@ -153,24 +197,6 @@ Or version and architecture:
153197

154198
new DriverManager().SetUpDriver(new TaobaoPhantomConfig());
155199

156-
### Also you can implement your own services for download binaries and manage variables:
157-
public class TaobaoPhantomConfig : PhantomConfig
158-
{
159-
public string GetName()
160-
{
161-
return "TaobaoPhantom";
162-
}
163-
164-
public string GetUrl32()
165-
{
166-
return "https://npm.taobao.org/mirrors/phantomjs/phantomjs-<version>-windows.zip";
167-
}
168-
}
169-
170-
...
171-
172-
new DriverManager().SetUpDriver(new TaobaoPhantomConfig());
173-
174200
## Thanks
175201
Thanks to the following companies for generously providing their services/products to help improve this project:
176202

0 commit comments

Comments
 (0)