Tag: selenium

如何在Docker中运行黄瓜/seleniumtesting?

我正在努力从Docker镜像运行我的黄瓜testing。 这是我的设置: 我使用XQuartz的OSX来运行X11会话 我使用Ubuntu 14 Vagrant映像进行开发,并将其转发给我的X11会话 我正在尝试使用Firefox来运行Docker镜像,该镜像将使用我的XQuartz会话进行显示 到目前为止,我设法使用以下设置启动Firefox: # Dockerfile FROM ubuntu:14.04 RUN apt-get update && apt-get install -y firefox # Replace 1000 with something appropriate 😉 RUN export uid=1000 gid=1000 && \ mkdir -p /home/developer && \ echo "developer:x:${uid}:${gid}:Developer,,,:/home/dev:/bin/bash" >> /etc/passwd && \ echo "developer:x:${uid}:" >> /etc/group && \ echo "developer ALL=(ALL) NOPASSWD: ALL" […]

连接拒绝在Docker中运行selenium的错误

当尝试dockeriseseleniumEnd2Endtesting使用seleniumdocker图像'selenium/ standalone'我得到错误:错误检索从selenium服务器的新会话连接被拒绝! selenium服务器是否启动? seleniumselenium服务器启动根据控制台输出..任何想法? FROM selenium/standalone-chrome USER root # installing node RUN apt-get update RUN apt-get install -y curl RUN curl -sL https://deb.nodesource.com/setup_7.x | bash RUN apt-get install -y nodejs RUN node -v RUN npm -v # Installing Yarn #RUN rm -r /usr/local/bin/yarn RUN npm install -g -y yarn ENV PATH $PATH:/usr/local/bin/yarn #copying files WORKDIR […]

在旧版本的Firefox(v41.0)上运行Selenium(v3.4.0)

在浏览互联网之后,我失去了一些时间,我无法find解决scheme。 我目前正在尝试在旧版本的Firefox(这里是v41.0)上testing我的应用程序。 我正在通过Selenium的Docker 镜像 (v3.4.0)以及Firefox节点(v41.0)的docker镜像。 我知道对于老版本的Firefox,Geckodriver不兼容,但似乎有解决scheme使用 { "marionette": true } Firefox节点完美地连接到网格。 我可以使用docker exec -it <container-id> bash连接到它,但运行testing时出现问题。 我仍然试图find它,但我被封锁了。 这里是Dockerfile的代码:hub.docker.com/r/selenium/node-firefox/~/dockerfile/用于Firefox节点,这里是testing代码(使用MochaJS)。 test.it("should redirect to Google with FIREFOX 41.0", () => { var firefoxCap = Capabilities.firefox(); firefoxCap.set('marionette', true); driver = new webdriver.Builder() .usingServer(CONSTANTS.SELENIUM_HUB) .withCapabilities(firefoxCap) .build(); driver.get(CONSTANTS.GOOGLE_URL); driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE)); driver.wait(until.elementLocated(By.name(CONSTANTS.GOOGLE_SEARCH_KEY))).sendKeys(CONSTANTS.GOOGLE_SEARCH_VALUE); driver.findElement(By.name(CONSTANTS.GOOGLE_SEARCH_BUTTON_NAME)).click(); driver.wait(until.titleIs(CONSTANTS.GOOGLE_SEARCH_TITLE)); driver.wait(until.elementLocated(By.tagName(CONSTANTS.GOOGLE_RES_LINK))).click(); driver.wait(until.titleIs(CONSTANTS.GOOGLE_TITLE)); driver.quit(); }); 这里的日志 ~/dev/selenium-grids/src$ mocha –timeout 30000 […]

Selenium RemoteWebDriver立即崩溃InvalidOperaitonException

我正在尝试让selenium中枢工作。 每当我尝试创buildRemoteWebDriver时,它会崩溃与System.InvalidOperationException没有消息,InnerException等 我的机器在Windows 8.1上; 我正在使用docker工具箱运行一个集线器容器和两个节点容器(selenium/集线器和selenium/节点 – 火狐)。 (从长远来看,这些不会在我的本地主机上,但是我需要在创build一个更大的池之前在本地做一个概念validation) 我的代码: var capabilities = DesiredCapabilities.Firefox(); capabilities.SetCapability(CapabilityType.BrowserName,"firefox"); capabilities.SetCapability(CapabilityType.Platform, new Platform(PlatformType.Any)); //*** next line crashes creating the RemoteWebDriver using (IWebDriver driver = new RemoteWebDriver(new Uri("http://192.168.99.100:4444/wd/hub"), capabilities)) { driver.Navigate().GoToUrl("http://www.google.com"); Console.WriteLine(driver.Title); } 我很确定中心URI是正确的 – 去http://192.168.99.100:4444/wd/hub给我一些JSON,和http://192.168.99.100:4444/grid/console显示一个控制台2远程代理连接。 堆栈跟踪exception: at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities […]

我怎样才能从docker容器的网格上运行seleniumUItesting?

我试图让我的testing运行器应用程序完全Docker化。 我使用公共集线器和节点图像来创build一个Selenium Grid,它可以正常工作 – 我可以在Dockerized Grid上本地运行我的testing。 现在,我需要做的就是Dockerize我的testing应用程序代码,并在Grid上运行它。 我创build了一个docker-compose文件来设置网格,然后运行testing代码。 不幸的是,当从Docker容器运行testing时,他们似乎无法连接到集线器。 我检查了testing运行器容器的日志,并从testing的第一步看到一些输出。 然后挂在那里大约一分钟,并输出以下内容: Net::ReadTimeout (Net::ReadTimeout) 我进入dockertesting运行器容器,并能从那里ping集线器,所以我相信testing运行者可以与集线器交谈。 我指定我的驱动程序configuration如下所示: Capybara.register_driver :remote_hub_chrome do |app| caps = Selenium::WebDriver::Remote::Capabilities.chrome caps.version = "59.0.3071.115" caps.platform = "LINUX" Capybara::Selenium::Driver.new( app, :browser => :chrome, :url => "http://hub-container:4444/wd/hub", :desired_capabilities => caps ) end 正如你所看到的,它会尝试打到hub-container域,它应该能够,因为我可以从容器中ping它。 我在浏览器节点容器上看不到任何日志信息,所以看起来甚至没有尝试到达。 我能够在Docker容器以外的本地机器上运行完全相同的testing。 唯一的区别是我必须更改hub-container到本地主机,因为我没有从容器内运行了。 有没有人有任何想法,为什么我不能从一个docker集装箱运行testing? 撰写文件: version: "3" services: hub: image: selenium/hub ports: – […]

Vue Webpack模板的E2E不适用于无头盒

有了vue-cli的webpack模板…有没有人得到npm运行e2e在无头盒上工作? 我试着在docker的节点上运行它:最近和下elgalu /docker – selenium两次我得到这个神秘的错误 Starting selenium server… started – PID: 6621 [Test] Test Suite ===================== Running: default e2e tests Error retrieving a new session from the selenium server Connection refused! Is selenium server started? { state: 'unknown error', sessionId: null, hCode: 648061585, value: { localizedMessage: null, cause: null, suppressed: [], message: null, hCode: 1628902597, […]

为什么在Docker中运行ChromeDriver 2.31无法启动?

我有一个基于ubuntu:xenial的Docker容器。 当我尝试运行selenium Chrome加载不断 >>> from selenium import webdriver >>> from selenium.webdriver.chrome.options import Options >>> chrome_options = Options() >>> chrome_options.add_argument("–headless") >>> path_to_chromedriver = '/usr/local/bin/chromedriver' >>> browser = webdriver.Chrome(path_to_chromedriver, chrome_options=chrome_options) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__ desired_capabilities=desired_capabilities) File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 140, in __init__ self.start_session(desired_capabilities, browser_profile) File […]

如何在Docker上创build和使用chrome来与Jenkins一起运行seleniumtesting?

我对Docker知之甚less,需要在没有Chrome的Jenkinstesting机器上运行java maven seleniumtesting。 无头奔跑不是一个select。 请大家提供一些有用的信息。

用Selenium安装Docker(Python 3 – Anaconda)

我正在使用Windows,并希望安装Selenium Decker,因为它可以更改每个浏览器实例的时区。 我的问题是如何安装在与pythonPython的窗户上? 我找不到在Windows中安装这个文件。 https://github.com/SeleniumHQ/docker-selenium 这样我可以运行如下命令: $ docker run -d selenium/hub -e "TZ=US/Pacific"… $ docker run -it selenium/node-chrome-debug -e "TZ=US/Eastern"… 这些命令在Powershell中无法识别 我已经下载了这个文件,只能findLinux的信息。 这是不是能够与Python集成?

OSError:在Docker容器中使用python运行selenium时

我最近学习了Docker的基础知识,以及如何创build和运行图像。 我正在尝试创build一个python脚本的图像,这个脚本会将一些数据页面抓取并上传到服务器。 我使用Selenium,Chromium和Windows chromedriver。 我试图在我的Windows机器上构build映像,并能够将它部署在一堆Linux / Windows服务器上。 目前,我只是在同一个Windows机器上构build和运行,直到我运行,但是我仍然得到相同的错误,即使脚本直接在机器上运行。 这是错误的: Traceback (most recent call last): File "my-app.py", line 796, in <module> startScraper(); File "my-app.py", line 92, in startScraper browser = webdriver.Chrome(chrome_options = options, executable_path = path_to_chromedriver); File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__ self.service.start() File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "/usr/local/lib/python3.6/subprocess.py", line 707, in […]