看不到弹出窗口的HTML如何从硒进行交互

问题描述:

我想选择状态形成一个新的窗口弹出窗口。点击选择状态按钮后,它会打开对话框页面,但我看不到该页面的HTML。所以不知道如何与硒对话框页面进行交互。看不到弹出窗口的HTML如何从硒进行交互

注意:我已切换到新窗口,但无法从此处继续。

HTML看起来像这样..

enter image description here

点击选择状态按钮下面的对话框页面打开后。

Select Status Dialog

,但我可以看到对话框页面的HTML,所以如何与它进行交互形式的硒?

更新-14/09/17

当我选择状态单击它调用下面的网址。在单独的选项卡中打开该URL并能够看到HTML。

http://xxx.xxx.xxx.int/tasks/status.aspx?CurrFilters=OPEN

enter image description here

试图选择像下面从新窗户值...

public void SelectStatus() 
    { 
     _SelectStatus.Click(); 
     Browser.Switch_to_child_page(); 
     _container.FindElement(By.CssSelector("input[onclick^='SelectAll']")).Click(); 
    } 

得到下面的错误。

测试 'x.RegressionSuite.TestCases.xTest.TC_x' 失败: OpenQA.Selenium.StaleElementReferenceException:元素不再 有效

+0

新窗口内是否有框架? –

+0

弹出窗口是一个单独的浏览器实例。你有没有试过看看启动页面的HTML?也许你可以在弹出窗口中获得页面的URL,并直接导航到它来访问HTML。 – JeffC

+0

我不认为你可以分享这个网址吗? – JeffC

它看起来像新的窗口弹出。你可以切换到新窗口。然后与它进行交互。

// Store the current window handle 
String winHandleBefore = driver.getWindowHandle(); 

// Perform the click operation that opens new window 

// Switch to new window opened 
for(String winHandle : driver.getWindowHandles()){ 
    driver.switchTo().window(winHandle); 
} 

//select the checkbox 
driver.findElement(By.xpath("xpath for checkbox")).click(); 

//click on select button 
driver.findElement(By.xpath("xpath for submit")).click(); 

// Close the new window, if that window no more required 
driver.close(); 

// Switch back to original browser (first window) 
driver.switchTo().window(winHandleBefore); 
+0

我正在移动到新窗口,但问题是如何选择复选框,因为我无法看到HTML? –

+0

请在新窗口中使用页面源代码或开发人员工具获取新窗口的html。 – Murthi

+0

不知道如何获取页面源代码,因为我无法在页面上单击鼠标右键。尝试了不同的浏览器。如果我右键单击它只有两个选项... 1.移动2.关闭。 –