Created
March 14, 2017 04:45
-
-
Save bvlion/bebfee66cb60f272d9eb97c05597d2f1 to your computer and use it in GitHub Desktop.
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
// 指定のウィンドウサイズに変更 | |
int width = 480; | |
int height = 600; | |
driver.manage().window().setSize(new Dimension(width, height)); | |
// 最大化 | |
/* driver.manage().window().maximize(); */ | |
if (isFirefox) { | |
FirefoxProfile profile = new FirefoxProfile(); | |
profile.setPreference("general.useragent.override", "ここに設定したいUAの文字列"); // "general.useragent.override"は固定。 | |
WebDriver driver = new FirefoxDriver(profile); | |
} else { | |
System.setProperty("webdriver.chrome.driver", "./driver/chromedriver.exe"); // ドライバーのパス | |
ChromeOptions options = new ChromeOptions(); | |
options.addArguments("--user-agent=ここに設定したいUAの文字列"); | |
WebDriver driver = new ChromeDriver(options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment