Safaridriver is an extension of a safari browser. Similar to Firefox, Safaridriver.safariextz extensions are available under the Org.openqa.selenium.safari path in the Selenium-safari-driver-xxx.jar package.
Package: Http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-safari-driver
Settings that may be required
使用该浏览器,只需要将driver改成SafariDriver即可:
Webdriver Driver = new Safaridriver ();
Selenium 2 run Safari browser (on Windows XP system)
1, configure the environment (what to install Jdk,eclipse,selenium,safari and so on, omit steps)
2, write the test code (very simple, simple new safaridriver (), such as the Google page for example, take a point value)
Webdriver driver =new safaridriver ();
Driver.get ("http://www.google.com.hk");
Driver.findelement (By.name ("Q")). SendKeys ("Webdriver");
Driver.findelement (By.name ("BTNK")). Click ();
New Webdriverwait (Driver, 3). Until (expectedconditions
. Titleis ("Webdriver-google Search"));
Dirver.quit ();
3, this time to run, there will be such a result:
The page stopped, and only so was a message showing "Safaridriver requesting connection at WS://LOCALHOST:43980/WD".
4, to extend the Safari browser:
1) Create a signing certificate for Safari so that you can add custom extensions to Safari
As for this process, it is generally the first registration of an Apple ID, after registration can be directly "get
Started ", and then follow the prompts step after step" Create certificate ". Detailed procedures can be Google
, it's simple.
2) SVN to this address: http://selenium.googlecode.com/svn/tags/selenium-2.25.0/(if
If the other version of SELENIUM0 is used, such as 2.21, then modify the last version number on the line/tags
/selenium-2.21.0/), check out all the items in the area (take a name like
SeleniumSafari2.25).
3) cmd to the SeleniumSafari2.25 directory of this newly customized name, use the command go
Safari, then start the Auto build (the build is the extension to be added later).
4) Open Safari, set the development menu monotonous; then choose develop--show extension creator--add
Extension--Select Seleniumsafari2.25/build/javascript/safari-driver
/safaridriver.safariextension (This is just the build)
5) Choose the installation, then OK, you can run the selenium code just try again.
5, the result of this time will still be out of that information page, but wait a moment,, the next will be normal to enter Google
Page.
Java Selenium Operation Safari