English 中文(简体)
在Selenium不同窗口举行新的浏览器会议
原标题:Open a new browser session in a different window in Selenium

我是新 to,刚刚开始使用。 我想在我的发言稿的不同窗口上开一门新的浏览器会议,不知道如何这样做。

我利用公开指挥进行了审判,并向乌尔德作了让步,但打开了同一个窗口。

任何想法?

问题回答

使用开放的Window而不是开放。 如果你收到一个信息,那就是Grea阻挡了人口,允许人口泛滥。 这也许会打开一个表格,而不是一个窗户,但可能符合你们的需要。

@Test
public void Test01() throws Exception {
openTab("http://www.xyz.com");
}

这将打开一条不同的窗口。 然后把新窗口转开。

public void trigger(String script, WebElement element) {
((JavascriptExecutor) driver).executeScript(script, element);
}

public Object trigger(String script) {
return ((JavascriptExecutor) driver).executeScript(script);
}

public void openTab(String url) {
String script = "var d=document,a=d.createElement( a );a.target= _blank ;a.href= %s ;a.innerHTML= . ;d.body.appendChild(a);return a";
Object element = trigger(String.format(script, url));
if (element instanceof WebElement) {
WebElement anchor = (WebElement) element;
anchor.click();
trigger("var a=arguments[0];a.parentNode.removeChild(a);", anchor);
} else {
throw new JavaScriptException(element, "Unable to open Window", 1);
}
}




相关问题
How to record popup windows with selenium IDE

While recording through Selenium IDE, When a pop up window opens it is not getting recorded. "At the time of executing an error message is displayed.Please help me out.

Problems with Error: There was an unexpected Confirmation!

I am trying to delete a user from a table. At first I was getting a timeout error but used the BeatnicClick() as described here: Selenium IDE click() timeout That solved the timeout error but I m ...

How to create nested test suites for Selenium IDE?

I need to create a nested test suite in Selenium that will run in the Selenium IDE or the Selenium TestRunner. This is basically the structure that I m trying to achieve: MasterTestSuite.html - ...

Selenium-Flex API sample problem

I m trying the sample demo of selenium flex API. After following the instructions on the main page for compiling the project with sfpi.swc and taking the generated selben.swf in bin directory and ...

Selenium Automation

Is there any way in Selenium ide, so that we get list and handlers for all controls provided on any page? So if we get that we can test that one by one using RC and it ll greatly helpful when there ...

热门标签