Tag: firefox

如何使用Selenium(Java)在浏览器中禁用JavaScript?

在我的function自动化中,我需要在浏览器中禁用JavaScript并运行流程。 如何禁用JavaScript? 试过firefox和Chrome的DesiredCapabilities。 DesiredCapabilities dc = new DesiredCapabilities(); dc.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT, false) 和 DesiredCapabilities dc = new DesiredCapabilities(); dc.setJavascriptEnabled(false); 对于firefox,尝试过1)为firefox设置配置文件 2)添加附加组件 – noScript.xpi 3)profile.setPreference(“javascript.enabled”,false); 4)通过UI,尝试将标志 – “about:config”中的“javascript.enabled”更改为false。 在这里,打开firefox并给出“about:config”警告 – “这可能会使您的保修失效!”。 有一个按钮 – “我会小心的,我保证!” id – warningButton。 应单击此按钮以继续。 要单击此按钮,请使用driver.findElement(By.id(“warningButton”))。click(); 但它不起作用。 以上所有选项均无效。 任何建议都会有所帮助。

无法阅读VR Path Registry – Selenium Webdriver

我正在尝试使用Selenium和java执行测试用例,但页面没有完全加载,我在eclipse控制台中收到此消息: 无法读取VR Path Registry 这条消息是什么意思? 这是代码 FirefoxDriver driver = new FirefoxDriver(); try { driver.get(url); WebDriverWait wait = new WebDriverWait(driver, 10); driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(idName))); … 控制台: 1513781293556 Marionette INFO Enabled via –marionette Unable to read VR Path Registry from C:\Users\jo\AppData\Local\openvr\openvrpaths.vrpath [Parent 12932, Gecko_IOThread] WARNING: pipe error: 109: file z:/build/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346 Unable to read VR Path […]

如何调试Firefox警报框自动关闭并且无法检测Serenity BDD中的警报?

[main] ERROR net.serenitybdd.core.Serenity – 不存在警报(警告:服务器未提供任何堆栈跟踪信息) 我的问题与这个“ 用Selenium WebDriver未检测到的Firefox警报框 ”完全相似 但我无法找到解决方案。 即使我已经尝试了所有类型的等待,更改了Firefox版本并尝试了共享链接中提到的解决方案。 但是,要么我无法实现它,要么它无法正常工作。 执行此任务时,当我单击“更新”按钮并且工作正常时,会弹出手动弹出窗口。 但是,当我使用自动弹出显示执行相同操作并立即在几分之一秒内自动关闭时,平静会抛出无警报未找到的错误。 此外,自动化期间出现的警报窗口与手动执行期间发现的警报窗口略有不同。 如果您想在Windows中看到差异,请参阅上面分享的链接。 public void i_click_update_button() throws InterruptedException { btn_update.waitUntilClickable().click(); // clicks the button & pop-up comes } public void Accept_POP_UP() throws InterruptedException { getAlert().accept(); // code to accept the alret. I have already tried implementing wait & everything. problem is pop-up […]

geb.driver.DriverCreationException:无法从回调创建驱动程序

我正在设置一些Geb测试,我得到“geb.driver.DriverCreationException:无法从回调创建驱动程序”错误。 Geb将尝试启动测试浏览器窗口,但一旦它启动,我的测试都没有运行,我得到上述错误。 我刚刚对Firefox 32.0.2进行了自动Firefox更新,所以我怀疑新版本和Selenium Web Driver不再玩得很好了吗? 我该如何解决这个问题? 这是我一直在使用的Geb.config文件? 我没有改变它约5个月,它一直工作到现在… import org.openqa.selenium.firefox.FirefoxDriver import geb.waiting.WaitingSupport reportsDir = “target/geb-reports” driver = { //path is specific to each machine. This is the path to firefox.exe def pathToBin = ‘C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe’ System.setProperty(“webdriver.firefox.bin”,pathToBin) def driverInstance = new FirefoxDriver(); driverInstance.manage().window().maximize() driverInstance }

通过selenium在firefox中打开私有模式

其实我想通过selenium打开一个隐身/私有模式的firefox浏览器,但每次我试过它都是在正常模式下打开firefox。 经过一些谷歌搜索我得到了这个代码,我曾经通过selenium在firefox中打开私有模式,但它无法正常工作。 FirefoxProfile firefoxProfile = new FirefoxProfile(); firefoxProfile.setPreference(“browser.privatebrowsing.autostart”, true); WebDriver driver = new FirefoxDriver(firefoxProfile); driver.get(“http://www.google.com”); 有人可以帮忙怎么做?

使用BrowserMobProxy,Selenium,Firefox,marionette / gecko获取请求和响应

我正在尝试使用BMP的RequestFilter和ResponseFilter获得响应和请求。 但是,当网页加载时,控制台中不会打印任何内容。 其他一切似乎都有效。 也许BMP不是在看GeckoDriver? 我使用的是Firefox 50.0,BrowserMobProxy 2.1.2,Selenium 3.0.1和GeckoDriver 0.11.1 测试代码如下。 有人可以帮帮我吗? 非常感谢你! BrowserMobProxy server = new BrowserMobProxyServer(); server.enableHarCaptureTypes(CaptureType.REQUEST_CONTENT, CaptureType.RESPONSE_CONTENT); server.start(); int port = server.getPort(); server.addRequestFilter((request, content, info) -> { String q = URLDecoder.decode(info.getOriginalUrl(), “UTF-8”); System.out.println(“Request: “+q); return null; }); server.addResponseFilter((response, content, info) -> { String type = response.headers().get(“Content-Type”); System.out.println(“Response: “+info.getOriginalRequest()); System.out.println(type); }); Proxy proxy = […]

Java Web Start Applet打开新的浏览器窗口/选项卡忽略目标

成功将applet迁移到java webstart applet后,我注意到每次调用 getAppletContext().showDocument( new URL(“http://”+ host+ “/” + filename + language + “.htm”), “Helppage”); 打开一个新的浏览器窗口(Win 7 / MSIE11)或选项卡(firefox取决于配置),虽然我显然请求一个特定的命名可能已经打开的浏览器窗口。 有没有人成功地将这些调用重定向到一个浏览器窗口(选项卡)? 如果有,怎么样? 看起来与如何关闭由Java Web Start打开的浏览器窗口类似的上下文 提前致谢

来自Selenium 2 / WebDriver的Id的jQuery元素选择器

我可以在Selenium中使用((RemoteWebElement) webElement).getId()获取元素的ID,它返回如下字符串: {e9b6a1cc-bb6f-4740-b9cb-b83c1569d96d} 我想知道该ID的来源。 我正在使用FirefoxDriver() ,所以这个Firefox有关吗? 有没有办法只通过知道这个ID来选择一个带有Jquery的元素?

在Hadoop的mapreduce框架中运行“Selenium Webdriver”,在地图步骤中冻结

几天前,我决定让selenium webdriver(第三方软件包)在hadoop的mapreduce框架中运行。 我遇到了一个问题。 地图步骤冻结在new FirefoxDriver(); 。 FirefoxDriver类位于名为selenium-server-standalone-2.38.0.jar的第三方jar中。 如果有人有经验或兴趣,我需要你的帮助! 一些细节: 问题详情 为了在命令行中运行代码,我使用“Xvfb”来停止Firefox图形界面。 然后我在开始时说的问题出现了。 我查看了tasktraker的日志,并在this.driver = new FirefoxDriver(ffprofile);找到代码冻结this.driver = new FirefoxDriver(ffprofile); 虽然代码已冻结,但firefox已经设置完毕,我使用ps -A | grep firefox检查 ps -A | grep firefox 环境: ubuntu 10.04 32bit; Hadoop的1.2.0; Mozilla Firefox 17.0.5; selenium – 服务器 – 独立-2.38.0.jar; xvfb的; 提示 (1)Hadoop以Pesudo分布式运行; (2)当我在Eclipse中运行代码时,每件事情都可以。火狐按计划弹出。(我最后会显示演示代码); (3)如果你运行到org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within […]

Selenium Webdriver:在firefox中抑制不受信任的连接消息

我已经使用了firefox的selenium webdriver,但我不知道它是否由于昨天的firefox更新或网站上发生了一些变化,但现在每次驱动程序打开页面我都会在firefox中获得不受信任的连接页面,所以我必须手动添加例外。 我无法访问该网站以供其他人测试,因为它是我们正在创建的内部网站,但firefox中的消息是: TestingSite使用无效的安全证书。 证书不受信任,因为没有提供发行者链。 (错误代码:sec_error_unknown_issuer) 在我的测试中,我创建了一个新的firefox配置文件并设置了这两个值: f.setAcceptUntrustedCertificates(true); f.setAssumeUntrustedCertificateIssuer(false); 我读过关于在人们遇到类似问题的其他post上设置这些内容并且它似乎在过去几个月中有效但现在我再次获得例外,但仅在这一个网站上。