Last active
October 5, 2016 11:49
-
-
Save hidepin/3b55841e9c1d7705f96e to your computer and use it in GitHub Desktop.
selenium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## RemoteWebDriver | |
### firefox | |
1. サーバを起動 | |
java -jar selenium-server-standalone-xxx.xxx.xxx.jar | |
2. リモート呼び出しのソース | |
public static void main(String[] args) { | |
DesiredCapabilities capabilities = DesiredCapabilities.firefox(); | |
RemoteWebDriver remoteWD = null; | |
try { | |
remoteWD = new RemoteWebDriver(new URL("http://xxx.xxx.xxx.xxx:4444/wd/hub"), capabilities); | |
remoteWD.get("file://C:/selenium/Chapter 2/HTML/Selectable.html"); | |
処理 | |
remoteWD.quit(); | |
} catch (MalformedURLException) { | |
e.printStackTrace(); | |
} | |
} | |
### IE | |
1. サーバを起動 | |
java -Dwebdriver.ie.driver="C:\IEDriveServer.exe" -jar selenium-server-standalone-xxx.xxx.xxx.jar | |
2. リモート呼び出しのソース | |
public static void main(String[] args) { | |
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); | |
RemoteWebDriver remoteWD = null; | |
try { | |
remoteWD = new RemoteWebDriver(new URL("http://xxx.xxx.xxx.xxx:4444/wd/hub"), capabilities); | |
remoteWD.get("file://C:/selenium/Chapter 2/HTML/Selectable.html"); | |
処理 | |
remoteWD.quit(); | |
} catch (MalformedURLException) { | |
e.printStackTrace(); | |
} | |
} | |
### Chrome | |
1. サーバを起動 | |
java -Dwebdriver.chrome.driver="C:\chromedriver.exe" -jar selenium-server-standalone-xxx.xxx.xxx.jar | |
2. リモート呼び出しのソース | |
public static void main(String[] args) { | |
DesiredCapabilities capabilities = DesiredCapabilities.chrome(); | |
RemoteWebDriver remoteWD = null; | |
try { | |
remoteWD = new RemoteWebDriver(new URL("http://xxx.xxx.xxx.xxx:4444/wd/hub"), capabilities); | |
remoteWD.get("file://C:/selenium/Chapter 2/HTML/Selectable.html"); | |
処理 | |
remoteWD.quit(); | |
} catch (MalformedURLException) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment