Webdriver:用于动态禁用/启用JavaScript弹出窗口的Firefox配置文件
Webdriver: Firefox profile for disable/enable javascript popup dynamically
我正在编写一个测试用例,我必须关闭一个java脚本弹出窗口。我的代码在 Windows 中工作正常,但我正在基于 centOS 的服务器中部署可执行文件,其中出现如下错误:
Element is not clickable at point (719, 9.899993896484375). Other element would receive the click: <li style="display: block; bottom: 0px;"
有人可以告诉我可能有什么问题吗?
我也尝试了以下方法,但它不起作用。
FirefoxProfile p = new FirefoxProfile();
p.setPreference("browser.popups.showPopupBlocker", false);
p.setPreference("browser.history.allowPopState", false);
p.setPreference("privacy.popups.showBrowserMessage", false);
p.setPreference("privacy.popups.usecustom", false);
driver = new FirefoxDriver(p);
我可以解决这个问题。我没有单击 JS 弹出窗口的关闭按钮,而是通过注入执行 javascript 来删除弹出窗口。
JavascriptExecutor jsExecutor = (JavascriptExecutor)driver;
jsExecutor.executeScript("return document.getElementsByClassName('dateInfo')[0].remove()");
使用JavascriptExecutor
单击:-
WebElement element = "Your Element";
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element );
希望它能帮助你:)
相关文章:
- 使用javascript配置文件作为handlebas博客模板,但配置不是't工作正常
- 我可以访问量角器配置文件中的参数吗
- 如何从配置文件中设置Angular值
- SoundCloud API-基于系统中的ID创建用户配置文件
- 先在Angular中加载配置文件,然后再加载其他文件
- 正在读取节点中的配置文件
- 检查蒸汽配置文件url是否有效
- 将配置文件文件夹移动到sdcardfirefoxmobile14.0
- 可能有一个javascript和php的配置文件
- 对CommonJS配置文件使用全局变量
- 未从Selenium网络驱动程序中的配置文件接收到正确的值
- 使用AddThis-config-data_ga_property向两个Google Analytics配置文件报告
- 如何使用浏览器“需要”配置文件,但不将此文件包含在捆绑包中
- Webdriver:用于动态禁用/启用JavaScript弹出窗口的Firefox配置文件
- 如何从 Webjar 解析多个 RequireJS 配置文件
- 通过oauth令牌passport.js访问用户配置文件
- mongodb用户配置文件添加输入时出现问题
- 如何使用ian:accounts-ui-botstrap-3根据Meteor中的用户输入设置配置文件字段值
- 带有所有用户操作的业务逻辑的Javascript配置文件
- 设置Selenium Firefox配置文件