Tag: selenium grid

如何使用IE更改默认下载目录(Internet Explorer 11)

在这篇文章中,我看到了为Chrome和Firefox设置下载目录的解决方案如何在使用chrome driver / firefox驱动程序时更改Webdriver中的文件下载位置 这些对我来说是完美的(接受的答案),但是我无法找到有关使用Internet Explorer 11执行此操作的任何信息。有谁知道我在哪里可以找到这些信息?

在Selenium Grid中注册PhantomJS节点时出错

我有以下问题 我成功推出了Selenium Grid hub: java -jar selenium-server-standalone-2.53.0.jar -role hub 之后我尝试使用以下命令启动PhantomJS节点: phantomjs –webdriver=8090 –webdriver-selenium-grid-hub=http://localhost:4444 但得到了错误: [INFO – 2016-03-25T13:56:28.397Z] GhostDriver – Main – 在端口8090上运行[INFO – 2016-03-25T13:56:28.397Z] GhostDriver – Main – 注册到Selenium HUB’http :// localhost :4444 ‘版本:使用’127.0.0.1:8090’与org.openqa.grid.selenium.proxy.DefaultRemoteProxy作为远程代理。 [ERROR – 2016-03-25T13:56:28.400Z] GhostDriver – main.fail – {“line”:97,“sourceURL”:“phantomjs://platform/hub_register.js”,“stack”:“register @” phantomjs://platform/hub_register.js:97:79 \ nglobal code @ phantomjs://code/main.js:78:37“} phantomjs://platform/console++.js:263错误 标准节点工作正常,但PhantomJS错误。 我做错了什么?

使用Java和TestNG在WebDriver上同时在不同的操作系统和浏览器上执行测试

我在我的系统中配置了网格并编写了我的测试脚本。 我可以在任何指定的操作系统和任何浏览器上运行我的测试,但一次只能在一个操作系统和一个浏览器上运行,而不是所有操作系统和所有浏 这就是我所做的。 请告诉我如何配置它以便它可以在一次配置的OS中运行。 我使用Java的脚本如下: import java.net.MalformedURLException; import java.net.URL; import org.junit.AfterClass; import org.openqa.selenium.*; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.*; public class GridWithWebdriver { public WebDriver driver; @Parameters({“browser”}) @BeforeClass public void setup(String browser) throws MalformedURLException { DesiredCapabilities capability=null; if(browser.equalsIgnoreCase(“firefox”)){ System.out.println(“firefox”); capability= DesiredCapabilities.firefox(); capability.setBrowserName(“firefox”); capability.setPlatform(org.openqa.selenium.Platform.ANY); //capability.setVersion(“”); } if(browser.equalsIgnoreCase(“iexplore”)){ System.out.println(“iexplore”); capability= DesiredCapabilities.internetExplorer(); capability.setBrowserName(“iexplore”); capability.setPlatform(org.openqa.selenium.Platform.WINDOWS); //capability.setVersion(“”); } driver = […]

如何杀死Selenium Grid节点中的线程

我在Selenium Grid中运行代码。 我有一个名为TestBase的类,如下所示,我想在单击按钮时退出所有线程,但是当我单击按钮时会抛出NullpointerException。 public class TestBase { protected ThreadLocal threadDriver = null; Button b; Frame f; static boolean flag = true; @BeforeMethod public void setUp() throws MalformedURLException { if(flag) { JFrame calcFrame = new JFrame(); flag = false; calcFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton button1 = new JButton(“1”); button1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent ae) {closure();} }); calcFrame.add(button1); calcFrame.setVisible(true); […]

对同一个IEdriver实例进行多次测试 – 内存问题

我在我的节点上运行了很多selenium测试,这是windows机器。 为了通过避免在每次测试后启动/关闭IEDriver实例来加速测试执行,我决定为每个测试重用相同的驱动程序实例。 使用firefox和chrome一切正常,但IE11存在严重问题。 大约30分钟后,IE冻结没有任何exception,执行停止,它完全失去与我的节点的连接。 我可以看到IE11进程(iexplore.exe)使用大量内存资源(1.5 GB或更多),我需要使用任务管理器将其关闭以将其关闭。 有没有人遇到过这种问题以及如何避免它(除了为每个测试创建新的驱动程序实例),是否可以在同一个IEdriver实例上运行多个测试? 我正在使用IEDriver 3.0.0,Internet Explorer 11.在Windows Server 2012和Windows 8.1机器上也是如此。

在selenium网格上创建并上传文件

我的一个测试用例是将文件上传到应用程序。 通过创建伪造文件并获取文件的绝对路径并填充输入字段并单击上载,可以轻松完成Witouth网格。 但是,当我使用网格时,该文件不在托管节点的计算机上。 无论如何要么将文件发送到节点或告诉节点创建文件并获取绝对路径。

45000 ms后无法在端口7055上连接到主机127.0.0.1。 用FF版26.0和selenium独立jar2.39

我正在尝试连接到我的AWS unix机器上安装了FF版本26.0的selenium 2.30,但是当我启动访问selenium的客户端时,我遇到了以下错误。 此外,当我尝试与selenium独立jar 2.38.0相同时,它工作正常,但在一两天的一段时间后突然发生,它开始给出2.38.0以下的错误。 不知道为什么会这样? 任何的想法?? 项目是我有一个multithreading应用程序,其中客户端持续执行一些线程,ping一些URL和所有,它继续发生,除非发生如下的一些问题。 Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output: Error: no display specified Error: no display specified Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’ System info: os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.4.76-65.111.amzn1.x86_64’, java.version: ‘1.7.0_51’ Driver info: driver.version: […]

运行selenium remotedriver时出现带有NativeConstructorAccessorImpl.newInstance0的SessionNotCreatedException错误

我运行以下但得到错误 public class base { public static WebDriver driver; public static void main(String[] args) throws MalformedURLException, InterruptedException { System.setProperty(“webdriver.chrome.driver”, “C:\\code\\lib\\browser drivers\\chromedriver.exe”); String URL = “http://www.google.com”; String Node = “http://localhost:4444/wd/hub”; DesiredCapabilities cap = DesiredCapabilities.chrome(); cap = DesiredCapabilities.chrome(); cap.setPlatform(org.openqa.selenium.Platform.WINDOWS); driver = new RemoteWebDriver(new URL(Node), cap); driver.navigate().to(URL); Thread.sleep(5000); driver.quit(); } } 显示的错误如下: Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Unable […]

SessionNotCreatedException:无法创建新服务:在Ubuntu上使用Selenium Grid的GeckoDriverService无法驱动Firefox

我无法使用geckodriver从Selenium驱动Firefox。 这很奇怪,因为chrome使用相同的框架驱动而没有错误! 这些是我的版本号: Firefox 54.0 (64-bit) Chrome Version 62.0.3202.94 (Official Build) (64-bit) selenium-server-standalone-3.7.1.jar client-combined-3.5.3-nodeps.jar geckodriver-v0.19.1-linux64 chromedriver_linux64 Ubuntu 16.10 我从Selenium webdriver获得的错误如下: ——————————–Error: leder@leder-VirtualBox:~/Source/SeleniumCheese/bin$ ./execute_grid.sh Exception in thread “main” org.openqa.selenium.SessionNotCreatedException: Unable to create new service: GeckoDriverService Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’ System info: host: ‘leder-VirtualBox’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.8.0-59-generic’, java.version: […]

如何在网格上运行时关闭ChromeDriver?

我目前正在使用带有Selenium Grid 2的RemoteWebDriver通过TestNG套件运行我的测试。 这适用于Firefox和IE。 现在我添加了Chrome并且测试运行正常,但是在套件的所有测试之后调用driver.quit()时总是得到一个Exception(适用于FF和IE)。 Exception看起来像这样: Error communicating with the remote browser. It may have died. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:472) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:476) at org.openqa.selenium.remote.RemoteWebDriver.quit(RemoteWebDriver.java:346) at setups.StandardChromeSetup.tearDown(StandardChromeSetup.java:42) 19 lines not shown Caused by Error communicating with the remote browser. It may have died. org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:467) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:476) […]