[英]Selenium + C# How to switch another Tab of Firefox when click a link and it will open in another tab?
I'm using SeleniumRC with C#, How to switch another Tab of Firefox when click a link and it will open in another tab? 我在C#中使用SeleniumRC,单击链接时如何切换Firefox的另一个选项卡,它将在另一个选项卡中打开? Some one please help me out, in this functionality.
请有人帮我解决这个功能。 The goal is simple to move another opened tab to search some text.
目标很简单,即移动另一个打开的选项卡以搜索一些文本。
This code is in C# 这段代码在C#中
public void TheUntitledTest()
{
selenium.Open("/abc/static/index.html");
// selenium.WindowFocus();
selenium.Click("link=Privacy Statement");
selenium.WaitForPopUp("hello world - Mozilla Firefox", "20000");
selenium.SelectPopUp("hello world - Mozilla Firefox");
selenium.WaitForPageToLoad("30000");
for (int second = 0; ; second++)
{
if (second >= 60) Assert.Fail("timeout");
try
{
if (selenium.IsTextPresent("welcome")) break;
}
catch (Exception)
{
}
Thread.Sleep(1000);
}
}
See this solution for similar question of opening a new tab with WebDriver. 有关使用WebDriver打开新选项卡的类似问题,请参阅此解决方案。 https://stackoverflow.com/a/9122450/648076
https://stackoverflow.com/a/9122450/648076
It seems it is not supported out of the box but you can execute javascript that tries to open new tab for you. 似乎不支持立即使用,但是您可以执行试图为您打开新标签页的javascript。
您可以使用selenium.SelectWindow
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.