本文整理了Java中org.openqa.selenium.remote.RemoteWebDriver.switchTo
方法的一些代码示例,展示了RemoteWebDriver.switchTo
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RemoteWebDriver.switchTo
方法的具体详情如下:
包路径:org.openqa.selenium.remote.RemoteWebDriver
类名称:RemoteWebDriver
方法名:switchTo
暂无
代码示例来源:origin: la-team/light-admin
@Override
public TargetLocator switchTo() {
return webDriver.switchTo();
}
代码示例来源:origin: la-team/light-admin
@Override
public void forceFocusOnCurrentWindow() {
webDriver.switchTo().window(webDriver.getWindowHandle());
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-test-ui
@Override
public TargetLocator switchTo()
{
return this.wrappedDriver.switchTo();
}
代码示例来源:origin: org.eclipse.che.selenium/che-selenium-core
@Override
public TargetLocator switchTo() {
return driver.switchTo();
}
代码示例来源:origin: org.mycore/selenium-utils
public TargetLocator switchTo() {
return delegate.switchTo();
}
代码示例来源:origin: stackoverflow.com
public static void moveToAnotherTab(RemoteWebDriver driver) {
for (String winHandle : driver.getWindowHandles()) {
driver.switchTo().window(winHandle);
}
}
代码示例来源:origin: com.applitools/eyes-selenium-java3
public TargetLocator switchTo() {
return new EyesTargetLocator(this, driver.switchTo());
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public String get(TestRun ctx) {
try {
ctx.driver().switchTo().alert();
return "" + true;
} catch (NoAlertPresentException e) {
return "" + false;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().defaultContent();
return true;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().frame(Integer.parseInt(ctx.string("index")));
return true;
}
}
代码示例来源:origin: com.github.becausetesting/commons
/**
* @Title: switchToIframe @Description: TODO @author
* Judy.Zhu@greendotcorp.com @param @return void return type @throws
*/
public void switchToIframe(int iframeSequence) {
driver.switchTo().frame(driver.findElements(By.tagName("iframe")).get(iframeSequence));
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().alert().accept();
return true;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().alert().dismiss();
return true;
}
}
代码示例来源:origin: com.github.becauseQA/becauseQA-utils
public WebDriver window(String windowHandleOrName) {
try {
execute(DriverCommand.SWITCH_TO_WINDOW, ImmutableMap.of("handle", windowHandleOrName));
return RemoteWebDriver.this;
} catch (NoSuchWindowException nsw) {
// simulate search by name
String original = getWindowHandle();
for (String handle : getWindowHandles()) {
switchTo().window(handle);
if (windowHandleOrName.equals(executeScript("return window.name"))) {
return RemoteWebDriver.this; // found by name
}
}
switchTo().window(original);
throw nsw;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().frame(ctx.string("identifier"));
return true;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().window(ctx.string("name"));
return true;
}
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public String get(TestRun ctx) {
return ctx.driver().switchTo().alert().getText();
}
代码示例来源:origin: com.saucelabs/sebuilder-interpreter
@Override
public boolean run(TestRun ctx) {
ctx.driver().switchTo().alert().sendKeys(ctx.string("text"));
ctx.driver().switchTo().alert().accept();
return true;
}
}
代码示例来源:origin: paypal/SeLion
private void processAlerts(String browser) {
logger.entering(browser);
if (doesNotHandleAlerts(browser)) {
logger.exiting(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG);
return;
}
try {
Grid.driver().switchTo().alert();
logger.warning("Encountered an alert. Skipping processing of screenshots");
logger.exiting();
return;
} catch (NoAlertPresentException exception) {
// Gobble the exception and do nothing with it. No alert was triggered. So it is safe to proceed with taking
// screenshots.
}
}
代码示例来源:origin: paypal/SeLion
protected void validatePresenceOfAlert() {
String browser = Grid.getWebTestSession().getBrowser();
logger.finest("Validating presence of alert with browser " + browser);
if (doesNotHandleAlerts(browser)) {
logger.info(ALERTS_ARE_NOT_SUPPORTED_ERR_MSG);
return;
}
try {
Grid.driver().switchTo().alert();
String errorMsg = "Encountered an alert. Cannot wait for an element when an operation triggers an alert.";
throw new InvalidElementStateException(errorMsg);
} catch (NoAlertPresentException exception) {
// Gobble the exception and do nothing with it. No alert was triggered. So it is safe to proceed ahead.
}
}
内容来源于网络,如有侵权,请联系作者删除!