本文整理汇总了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"));
}