DearLee223
DearLee223

Reputation: 1

running tests on Chrome browser (version 30+) as well as WebView-based apps,by java

Well,guys here just only show the examply in python. i can not code it in java with the same example.

from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_experimental_option('androidPackage', 'com.android.chrome')
driver = webdriver.Chrome('./chromedriver', options=options)
driver.get('https://google.com')
driver.quit()

any advice

Upvotes: 0

Views: 187

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193308

The Java equivalent code will be:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOptions("androidPackage", "com.android.chrome");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
driver.quit();

Upvotes: 0

Related Questions