当前位置: 首页>>代码示例>>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;未经允许,请勿转载。