Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium [76.508][严重]:无法接收来自渲染器的消息(在控制台中)_Selenium - Fatal编程技术网

Selenium [76.508][严重]:无法接收来自渲染器的消息(在控制台中)

Selenium [76.508][严重]:无法接收来自渲染器的消息(在控制台中),selenium,Selenium,我的问题需要答案 在我的测试脚本中,我尝试接受警报,然后表在接受警报后应该得到加载,但同样的情况并没有发生。由于未加载表,我收到以下错误:- org.openqa.selenium.NoSuchElementException:没有这样的元素:无法定位元素:{“方法”:“xpath”,“选择器”:”//table[contains(@id,'Content\u gvSelectSeats')]/tbody“} (会话信息:chrome=58.0.3029.110) 这是一个同步问题吗 以下代码:

我的问题需要答案

在我的测试脚本中,我尝试接受警报,然后表在接受警报后应该得到加载,但同样的情况并没有发生。由于未加载表,我收到以下错误:-

org.openqa.selenium.NoSuchElementException:没有这样的元素:无法定位元素:{“方法”:“xpath”,“选择器”:”//table[contains(@id,'Content\u gvSelectSeats')]/tbody“} (会话信息:chrome=58.0.3029.110)

这是一个同步问题吗

以下代码:-

1) 点击fetch
reallocation.getreallocationclickfetch()//简单单击按钮

2) 现在微调器将移动并发出警报//等待警报并接受警报

 public boolean WaitUntilAlertLoad()
        {
             boolean foundAlert = false;
            WebDriverWait wait = new WebDriverWait(driver, 30 /*timeout in seconds*/);
            do {


                for(int i=0;i<100;i++)
                {   

                    try {
                        wait.until(ExpectedConditions.alertIsPresent());
                        foundAlert = true;
                        driver.switchTo().alert().accept();
                    } catch (Exception e) {
                        foundAlert = false;
                    }
                    if(i==99)
                    {
                        break;
                    }
                }

            }while(foundAlert=false);
            return foundAlert;
        } 
public boolean WaitUntilAlertLoad()
{
布尔值foundAlert=false;
WebDriverWait wait=新的WebDriverWait(驱动程序,30/*超时,以秒为单位*/);
做{

对于(int i=0;i,以下是您问题的答案:

在切换到Algy> /Calp>之前,您可以将“父窗口”的窗口句柄存储在一个字符串中:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );
现在,您可以切换到
警报
接受
解除
,如下所示:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );

一旦完成了带有警报的操作,请考虑通过字符串中存储的父窗口的窗口句柄切换回父/主窗口如下:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );

如果回答了您的问题,请告诉我。

以下是您问题的答案:

在切换到Algy> /Calp>之前,您可以将“父窗口”的窗口句柄存储在一个字符串中:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );
现在,您可以切换到
警报
接受
解除
,如下所示:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );

一旦完成了带有警报的操作,请考虑通过字符串中存储的父窗口的窗口句柄切换回父/主窗口如下:

//Stores the parent window handle
String windowHandle = driver.getWindowHandle();
//Perform your actions on the Alert by switching over
driver.switchTo().alert().accept();
//Switch back to the parent window
driver.switchTo().window(windowHandle );

让我知道这是否回答了你的问题。

不,它没有帮助:(你能考虑用最近的代码来更新这个问题以及这些变化并粘贴错误堆栈跟踪以进行进一步的分析吗?谢谢,没有帮助:(是否可以考虑将您最近的代码与更改一起更新问题并粘贴错误堆栈跟踪以进行进一步的分析?谢谢)