Tag: geckodriver

使用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 = […]

如何使用Geckodriver禁用Selenium中的Firefox日志记录?

我在用: firefox版本50.1.0 geckodriver版本0.11.1 selenium-java 3.0.1 我努力了 FirefoxProfile profile = new FirefoxProfile(); profile.setPreference(“webdriver.log.browser.ignore”, true); profile.setPreference(“webdriver.log.driver.ignore”, true); profile.setPreference(“webdriver.log.profiler.ignore”, true); FirefoxDriver driver = new FirefoxDriver(); 和 LoggingPreferences preferences = new LoggingPreferences(); preferences.enable(LogType.BROWSER, Level.OFF); preferences.enable(LogType.CLIENT, Level.OFF); preferences.enable(LogType.DRIVER, Level.OFF); preferences.enable(LogType.PERFORMANCE, Level.OFF); preferences.enable(LogType.SERVER, Level.OFF); DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(CapabilityType.LOGGING_PREFS, preferences); FirefoxDriver driver = new FirefoxDriver(capabilities); 这些方法都没有做任何事情来阻止记录。 如果这有助于某种方式,这是控制台输出: 第一种方法: http : //pastebin.com/23nate2G […]

使用selenium java在firefox gecko驱动程序中自动下载pdf

任何人都可以帮助创建配置文件并使用firefox( gecko 驱动程序 )设置选项,以自动下载selenium webdriver – java中的文件。 我已经搜索了很多谷歌搜索的选项,没有什么工作。 所以在堆栈溢出时发布我的查询。 如果可能,请帮助一些代码段。 这适用于selenium 3和firefox 52。 提前致谢。

将Selenium与Mozilla的GeckoDriver一起使用时,找不到CircularOutputStream类exception

当我使用Java Selenium Firefox geckodriver时出现问题。 这是问题所在: *操作系统:Windows 7 * Selenium版本:Selenium 3.0.0 beta4 * Java:8 * Geckodriver:v0.10.0 错误消息:org.openqa.selenium中org.openqa.selenium.firefox.FirefoxBinary。(FirefoxBinary.java:56)中的线程“main”java.lang.NoClassDefFoundError:org / openqa / selenium / remote / internal / CircularOutputStream中的exception.firefox.FirefoxBinary。(FirefoxBinary.java:52)at tool.openqa.selenium.firefox.FirefoxDriver。(FirefoxDriver.java:92)at tools.Cadencie.LoginCad(Cadencie.java:24)at tools.Cadencie.main( Cadencie.java:73)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java .lang.reflect.Method.invoke(Method.java:498)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)引起:java.lang.ClassNotFoundException:org.openqa.selenium java.net.URLClassLoader.findClass(URLClassLoader.java:381)中的.remote.internal.CircularOutputStream,位于java.lang.ClassLoader.loadClass(ClassLoader.java:424)at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:331)at java.lang.ClassLoader.loadClass(ClassLoader.java:357)… 10更多 码: public class Cadencie { static WebDriver driver; public void LoginCad(){ //System.setProperty(“webdriver.firefox.bin”, “C:\\Program […]

线程“main”中的exceptionjava.lang.IllegalStateException:在Ubuntu上运行Selenium Test时,驱动程序可执行文件不存在

我在eclipse中尝试过这段代码: import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class auto { public static void main(String[] args) { System.setProperty(“webdriver.gecko.driver”, “/root/Desktop/jarselenium/geckodriver.exe”); WebDriver driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.get(“https://www.easybooking.lk/login”); //driver.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS); } } 执行时我得到了这个错误: Exception in thread “main” java.lang.IllegalStateException: The driver executable does not exist: /root/Desktop/jarselenium/geckodriver.exe 如何在ubuntu中设置geckodriver位置?

如何使用Geckodriver保留我的Firefox配置文件缓存?

我需要使用Selenium和Geckodriver保留我的缓存。 我有一个Firefox配置文件,我在启动Geckodriver时加载它: ProfilesIni profilesIni = new ProfilesIni(); FirefoxProfile firefoxProfile = profilesIni.getProfile(“profile-name”); firefoxOptions.setProfile(firefoxProfile); 这可以正常工作,但它不会复制缓存。 去about:cache ,它是空的。 我想保留我的缓存,我想直接使用我的个人资料。 目前, Selenium/Geckodriver复制部分配置文件并使用它,但不会使用缓存。 使用Geckodriver时如何保持缓存?

Selenium 3.0 Firefx驱动程序因org.openqa.selenium.SessionNotCreatedException而失败:无法创建新的远程会话

Selenium 3.0 Firefx驱动程序因org.openqa.selenium.SessionNotCreatedException而失败:无法创建新的远程会话。 System.setProperty(“webdriver.gecko.driver”, “…./geckodriver.exe”); capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(“marionette”, true); driver = new FirefoxDriver(capabilities); Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@23aa363a, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@23aa363a, version=, platform=ANY}], required capabilities = Capabilities [{}] Build info: version: ‘3.0.0’, revision: ‘350cf60’, time: ‘2016-10-13 10:48:57 -0700’ System info: host: ‘D202540’, ip: ‘10.22.19.193’, os.name: […]

如何处理没有任何元素的浏览器通知弹出窗口?

如何按照图像按OK按钮。 我可以切换到这个窗口。 但它没有加载,直到我点击确定,所以没有任何元素。 警报手柄也没有帮助。 Autoit也无法检测到此弹出消息。 禁用通知也无法帮助。 有任何想法吗? 添加了两个screeshots。 Firefox快照: Chrome快照: p.companieGenreal.sActivities().click(); driver.switchTo().defaultContent(); String parent = driver.getWindowHandle(); p.companieGenreal.sAddNew().click(); p.companieGenreal.sAddJobOrder().click(); p.companieGenreal.sContract().click(); swithToChildWindow(parent); driver.switchTo().alert().accept();

Java Selenium Webdriver连接被拒绝

我在我的selenium webdriver上得到了太常见的连接拒绝错误。 几周前,相同的代码正在执行。 我一直在通过现有的post阅读,并尝试更新geckodriver和FireFox无济于事。 我可以在运行相同版本的驱动程序,浏览器和库等的另一台计算机上运行相同的代码。如何找到特定于此计算机的原因? 错误如下。 调试1调试2调试3 Exception in thread “main” org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:28379 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’ System info: host: ‘LT9LTDRC2’, ip: ‘10.130.3.15’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_131’ Driver info: driver.version: Gecko_Driver at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:250) […]

使用selenium的java出错:预期

我不明白为什么我得到错误Expected [object Undefined] undefined为一个字符串 这是脚本java LoginToGmail.java WebDriver driver; driver =new FirefoxDriver(); driver.manage().window().maximize(); driver.navigate().to(“http://www.facebook.com”); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); WebElement act= driver.findElement(By.id(“email”)); act.sendKeys(“rupali9392@gmail.com”); 完整堆栈错误是: org.openqa.selenium.InvalidArgumentException: Expected [object Undefined] undefined to be a string Build info: version: ‘unknown’, revision: ‘5234b32’, time: ‘2017-03-10 09:00:17 -0800’ Capabilities [{moz:profile=C:\Users\SHEKHAR\AppData\Local\Temp\rust_mozpr‌​ofile.mipot0y6Nzs5, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal ,platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0, platformVersion=6.1, moz:processID=5892, browserName=firefox, platformName=windows_nt}]