我无法点击或关闭弹出窗口。没有其他元素可以定位和关闭窗口。下面是定位窗口时抛出的错误。 我正在使用代码:
protected $webserviceParameters = array(
'fields' => array(
'id_default_group' => array('xlink_resource' => 'groups'),
'id_lang' => array('xlink_resource' => 'languages'),
'newsletter_date_add' => array(),
'ip_registration_newsletter' => array(),
'last_passwd_gen' => array('setter' => null),
'secure_key' => array('setter' => null),
'deleted' => array(),
'passwd' => array('setter' => 'setWsPasswd'),
/** inizio modifica aggiunta per il webservice */
'date_add' => array(),
/** fine della modifica */
),
'associations' => array(
'groups' => array('resource' => 'group'),
)
);
使用css选择器
WebElement noteDisplayWindow = driver.findElement(By.xpath("//body/div[2]/div[1]/button/span"));
noteDisplayWindow.click();
当我运行CSS选择器时,出现了这个错误。
org.openqa.selenium.WebDriverException:未知错误:
WebElement noteDisplayWindow1=driver.findElement(By.cssSelector("button[type='button'][class='ui-button']"));
noteDisplayWindow1.click();
(会话信息:chrome = 56.0.2924.87) (驱动程序信息:chromedriver = 2.28.455520,platform = Windows NT 6.1.7601 SP1 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:67毫秒 构建信息:版本:'未知',修订版:' 5234b32',时间:' 2017-03-10 09:00:17 -0800'
答案 0 :(得分:0)
尝试一次
WebElement myDynamicElement=driver.findElement(By.cssSelector("button[type='button'][class='ui-button']"));
new Actions(driver).moveToElement(myDynamicElement).click().perform();