當前位置: 首頁>>代碼示例>>Java>>正文


Java ChromeDriver.get方法代碼示例

本文整理匯總了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 ();
}
 
開發者ID:mfaisalkhatri,項目名稱:NaukriSite,代碼行數:21,代碼來源:Setup.java

示例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");
}
 
開發者ID:Yinqingseu,項目名稱:SeleniumTest,代碼行數:22,代碼來源:findByJsoup.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:8,代碼來源:ChromeWithGlobalOptionsJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:9,代碼來源:ChromeWithOptionsJupiterTest.java

示例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");
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:10,代碼來源:ScreenshotPngTest.java

示例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");
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:12,代碼來源:ScreenshotSurefireTest.java

示例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);
}
 
開發者ID:maxcleme,項目名稱:f4f-tts,代碼行數:41,代碼來源:ScrapperTtsUpdater.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:10,代碼來源:ChromeJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:7,代碼來源:LocalWebDriverTest.java

示例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);
}
 
開發者ID:grantleymorrison,項目名稱:FlashBoard,代碼行數:7,代碼來源:NavigationTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:7,代碼來源:ForceCacheJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:7,代碼來源:ChromeWithOptionsJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:7,代碼來源:ChromeWithOptionsJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:7,代碼來源:ChromeWithGlobalOptionsAndParentJupiterTest.java

示例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"));
}
 
開發者ID:bonigarcia,項目名稱:selenium-jupiter,代碼行數:7,代碼來源:SeleniumJupiterTest.java


注:本文中的org.openqa.selenium.chrome.ChromeDriver.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。