本文整理匯總了Java中org.openqa.selenium.chrome.ChromeDriver.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ChromeDriver.get方法的具體用法?Java ChromeDriver.get怎麽用?Java ChromeDriver.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openqa.selenium.chrome.ChromeDriver
的用法示例。
在下文中一共展示了ChromeDriver.get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: siteUp
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@BeforeMethod
public void siteUp () {
final String exe = "chromedriver.exe";
final String path = getClass ().getClassLoader ()
.getResource (exe)
.getPath ();
final String webSite = "http://www.naukri.com";
final String binaryPath = "C:\\Users\\DELL\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe";
System.setProperty("webdriver.chrome.driver", path);
ChromeOptions chromeOpt= new ChromeOptions();
chromeOpt.setBinary(binaryPath);
driver = new ChromeDriver (chromeOpt);
driver.get(webSite);
driver.manage ().timeouts ().implicitlyWait (10, TimeUnit.SECONDS);
driver.manage().window().maximize();
windowHandling ();
}
示例2: findsInIframByJsoup
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
protected static void findsInIframByJsoup() {
System.setProperty("webdriver.chrome.driver", "D:\\selenium\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
//��Ŀ��ҳ��
driver.get(url);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); //Ӧ�÷���get������
driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
long beginTime = System.currentTimeMillis(); //����Ԫ�ؿ�ʼʱ��
long timeOut = beginTime + Long.valueOf(5)*1000;
try {
List<WebElement> iframes = driver.findElements(By.tagName("iframe"));
JsoupXpathFind(iframes,targetXapth);
}catch(Exception e) {
e.printStackTrace();
}
long endTime = System.currentTimeMillis();
System.out.println("����Ԫ��ʱ�䣺"+(endTime - beginTime) +"ms");
}
示例3: webrtcTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void webrtcTest(ChromeDriver driver) {
driver.get(
"https://webrtc.github.io/samples/src/content/devices/input-output/");
assertThat(driver.findElement(By.id("video")).getTagName(),
equalTo("video"));
}
示例4: webrtcTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void webrtcTest(@Arguments({ "--use-fake-device-for-media-stream",
"--use-fake-ui-for-media-stream" }) ChromeDriver driver) {
driver.get(
"https://webrtc.github.io/samples/src/content/devices/input-output/");
assertThat(driver.findElement(By.id("video")).getTagName(),
equalTo("video"));
}
示例5: screenshotTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void screenshotTest(ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
imageFile = new File("screenshotTest_arg0_ChromeDriver_"
+ driver.getSessionId() + ".png");
}
示例6: screenshotTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void screenshotTest(ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
imageName = new File(
"./target/surefire-reports/io.github.bonigarcia.test.screenshot.ScreenshotSurefireTest",
"screenshotTest_arg0_ChromeDriver_" + driver.getSessionId()
+ ".png");
}
示例7: updateTt
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
private void updateTt(Consumer<Tt> onTtUpsert, Consumer<TtResult> onTtResultUpsert, ChromeDriver driver, Tt tt) {
tt.setUrl(String.format("%s%d/", "https://www.facebook.com/groups/first4figures/permalink/", tt.getId()));
driver.get(tt.getUrl());
WebElement timestampElement = driver.findElementByCssSelector(String.format("a[href*='%s']>[data-utime]", tt.getId()));
List<WebElement> values = driver.findElementsByCssSelector("a[data-tooltip-content$='other people']");
List<WebElement> category = driver.findElementsByCssSelector("div[role='presentation']>div:nth-child(2)>span");
if (timestampElement != null) {
Long timestamp = Long.parseLong(timestampElement.getAttribute("data-utime"));
tt.setCreationDate(timestamp);
}
if (values.size() < 2 || category.size() < 2) {
throw new RuntimeException("Couldn't parse TT from page: " + tt);
}
TtResult ttResult = new TtResult(UUID.randomUUID().toString(), tt.getId(), Instant.now().getEpochSecond());
for (int i = 0; i < 2; i++) {
Matcher matcher = Pattern.compile("-?\\d+").matcher(values.get(i).getAttribute("data-tooltip-content"));
if (!matcher.find()) {
throw new RuntimeException("Couldn't parse TT result from page : " + tt);
}
String label = category.get(i).getText();
Long value = Long.parseLong(matcher.group());
if ("Yes".equalsIgnoreCase(label)) {
ttResult.setYes(value);
} else if ("No".equalsIgnoreCase(label)) {
ttResult.setNo(value);
}
}
LOGGER.log(Level.INFO, String.format("upsert : %s", tt.toString()));
onTtUpsert.accept(tt);
LOGGER.log(Level.INFO, String.format("upsert : %s", ttResult.toString()));
onTtResultUpsert.accept(ttResult);
}
示例8: testWithTwoChromes
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Disabled("Redudant test for Travis CI suite")
// tag::snippet-in-doc[]
@Test
public void testWithTwoChromes(ChromeDriver driver1, ChromeDriver driver2) {
driver1.get("http://www.seleniumhq.org/");
driver2.get("http://junit.org/junit5/");
assertThat(driver1.getTitle(), startsWith("Selenium"));
assertThat(driver2.getTitle(), equalTo("JUnit 5"));
}
示例9: testWithChrome
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
public void testWithChrome(ChromeDriver chrome) {
chrome.get("https://bonigarcia.github.io/selenium-jupiter/");
assertTrue(chrome.getTitle().startsWith("selenium-jupiter"));
}
示例10: beforeTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@BeforeTest
public void beforeTest() {
System.setProperty("webdriver.chrome.driver", "Drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.get(url);
}
示例11: test
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
public void test(ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例12: headlessTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void headlessTest(@Arguments("--headless") ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例13: extensionTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void extensionTest(@Extensions("hello_world.crx") ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例14: chromeTest
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
void chromeTest(ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}
示例15: testWithChrome
import org.openqa.selenium.chrome.ChromeDriver; //導入方法依賴的package包/類
@Test
public void testWithChrome(ChromeDriver driver) {
driver.get("https://bonigarcia.github.io/selenium-jupiter/");
assertThat(driver.getTitle(),
containsString("A JUnit 5 extension for Selenium WebDriver"));
}