我已经打开了链接,现在我单击该页面上的登录链接,通过单击登录按钮,它会自动在新选项卡中打开。我必须填写该选项卡中的表格。为此,我尝试了以下代码:
Actions act = new Actions(Initialsetupfirefox.driver);
new Actions(Initialsetupfirefox.driver) .keyDown(Keys.CONTROL).click(Initialsetupfirefox.driver.findElement(By.xpath("//a[contains(text(),'LOGIN')]")))
.keyUp(Keys.CONTROL)
.perform();
Thread.sleep(3000);
new Actions(Initialsetupfirefox.driver).sendKeys(Initialsetupfirefox.driver.findElement(By.tagName("html")), Keys.CONTROL).sendKeys(Initialsetupfirefox.driver.findElement(By.tagName("html")),Keys.NUMPAD2).build().perform();
Run Code Online (Sandbox Code Playgroud)
这样我就可以切换焦点,但无法在此选项卡中执行任何操作。请建议