Tag: selenium webdriver

试图在Docker镜像上安装selenium python3软件包

我试过用selenium python包重新构build一个Docker镜像失败。 我不知道如何继续。 这是我的dockerfile: FROM selenium/standalone-chrome:latest WORKDIR /usr/local/bin RUN sudo apt-get update RUN sudo apt-get install software-properties-common RUN sudo apt-add-repository universe RUN sudo apt-get install python-pip RUN pip3 install -r requirements.txt RUN pip3 install . RUN pip3 install -e . COPY ./* ./ 我相当确定这是我的dockerfile是错误的,但尝试各种安装点的方法后,我画了一个空白。 在任何情况下,我然后调用:docker build -t webdriver。 其中输出以下内容: Sending build context to Docker daemon […]

在Docker镜像上开发抓取脚本 – 如何克服视觉浏览器的不足?

我想从网上抓取信息,以前的一个尝试教会了我,docker工作将会对我的脚本运行起到很大的作用,因为我在mac os x上开发脚本,然后在vm上运行它,通常它不会运行因为Ubuntu的依赖关系并不存在,而且已经certificate很难构build。 Docker克服了依赖性问题,但是现在我又面临一个不同的问题,那就是我需要在Docker镜像上以非无头模式开发脚本,看看它在做什么(或者至less我认为我是这样做的),而是在docker上不要认为可以在非无头模式下运行浏览器。 别人如何克服这个问题或以其他方式绕过它? 我在@Harald Norgren帮助我在这个图像上使用python3,selenium 这是我正在运行的脚本,但它还没有做任何事情,我只是包括它提供更多的背景,这是有帮助的。 import csv import time from selenium import webdriver import os import logging #logging.warning(data_store+file) import json project_dir = os.path.dirname(os.path.realpath(__file__)) data_store = project_dir+"/trends-data/" archive_folder = "archive" data_archive = data_store + archive_folder + "/" chromeOptions = webdriver.ChromeOptions() chromeOptions.add_argument("–headless") prefs = {"download.default_directory" : data_store} chromeOptions.add_experimental_option("prefs",prefs) driver = webdriver.Chrome( project_dir+'/chromedriver', chrome_options=chromeOptions ) […]

如何在docker-compose中将公共端口分配给端口5900

我有下面的YAML文件: seleniumhub: image: selenium/hub ports: – 4444:4444 firefoxnode: image: selenium/node-firefox-debug ports: – 4577 links: – seleniumhub:hub expose: – "5900" chromenode: image : selenium/node-chrome-debug ports: – 4578 links: – seleniumhub:hub expose: – "5900" docker工人ps: time="2017-04-01T17:57:44+03:00" level=info msg="Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows" CONTAINER ID IMAGE COMMAND CREATED […]

Selenium ChromeDriver无法加载资源:net :: ERR_CONNECTION_CLOSED

我使用Codeception使用WebDriver和Docker Selenium独立服务器运行一些验收testing。 我注意到,我的一个testing后,抛出一个错误,我得到这个logging: [Selenium browser Logs] 13:59:52.345 SEVERE – https://ssl.google-analytics.com/ga.js – Failed to load resource: net::ERR_CONNECTION_CLOSED 有趣的是,在网页上没有任何谷歌分析(或应用程序)。 我猜测,有一些匿名的使用情况分析,但不知道它是谁,是Selenium , Codeception还是包含libs,甚至是Selenium的ChromeDriver。 我用–net=host运行Selenium服务器,也许这–net=host有点关系。 任何人都知道如何closures这些分析,或让Codeception忽略失败的外部资源?

重新启动Selenium浏览器失败

有时docker的Selenium Hub给了我这个信息: Marking the node http://172.17.0.2:5555 as down: cannot reach the node for 2 tries 我现在想知道的是: 它会在一段时间后回来吗? 我如何监视并重新启动节点? 所以,如果节点有一些内部重启自己,那么我很想知道如何以及哪个。 我喜欢调整他们一点。 另一方面,我可以监视这个,跟踪相应的docker容器,并重新启动单个节点。 这里有什么可能? 大图是,我用docker-compose scale chrome=16构build了几个浏览器。 在一些WebDriver操作之后(是的,我使用了一个合适的::quit() ),浏览器只是失败/似乎挂起。

在哪里把testing文件的webdriverIOtesting – 使用docker集装箱?

我不明白如何运行我的nodeJS应用程序的webdriverIO e2etesting。 正如你所看到的,我的nodeJS应用程序也作为docker容器运行。 但是现在我得到了一些非常基本的东西: 那么我要把我想要运行的testing文件放在哪里? 我必须将它们复制到webdriverio容器中吗? 如果是,在哪个文件夹? 那么我该如何运行testing呢? 这是我的docker组成所有需要的docker集装箱的设置: services: webdriverio: image: huli/webdriverio:latest depends_on: – chrome – hub environment: – HUB_PORT_4444_TCP_ADDR=hub – HUB_PORT_4444_TCP_PORT=4444 hub: image: selenium/hub ports: – 4444:4444 chrome: image: selenium/node-chrome ports: – 5900 environment: – HUB_PORT_4444_TCP_ADDR=hub – HUB_PORT_4444_TCP_PORT=4444 depends_on: – hub myApp: container_name: myApp image: 'registry.example.com/project/app:latest' restart: always links: – 'mongodb' environment: – […]

AWS ECS Docker Timeout上的Selenium Mochatesting

问题:在 NodeJS平台上运行并在AWS ECS上运行的Selenuim Webdriver驱动的通过Mocha执行的UItesting对于例行超时(超时= 120000 ms,即2分钟)而言速度很慢。 build立: 我在AWS ECS上有一个集群。 群集有3个m4.xlarge实例,所以CPU /内存不是问题。 此外,EC2实例度量标准显示,即使运行testing,CPU /内存使用率也<1%。 每个容器都使用以下JSON定义: { "requiresAttributes": [ { "value": null, "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18", "targetId": null, "targetType": null }, { "value": null, "name": "com.amazonaws.ecs.capability.ecr-auth", "targetId": null, "targetType": null } ], "taskDefinitionArn": "someDefinition", "networkMode": "host", "status": "ACTIVE", "revision": 23, "taskRoleArn": null, "containerDefinitions": [ { "volumesFrom": [], "memory": 400, […]

在docker集装箱之间进行通信

我有一个服务器运行两个docker集装箱。 一个docker集装箱是一个networking服务器,另一个是一个selenium铬金属。 从容器与Web服务器,我想能够连接到铬驱动程序。 而Web服务器是这样启动的: docker run -i -p 80:80 -d '<name>:<version>' /sbin/my_init selenium驱动程序是这样启动的: docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:3.4.0 从主机上,我可以从curl的selenium容器中获得信息: curl http://localhost:4444/wd/hub/status # => {"state":"success","sessionId":………. 但是,从Web服务器容器我只得到: curl: (7) Failed to connect to localhost port 4444: Connection refused 我能做些什么来让包含Web服务器的容器能够连接到另一个容器?

Selenium WebDriver为Click操作抛出一个错误,但Click实际上是成功的

使用Selenium和Google Chrome进行合成浏览器testing时,我们会在特定网站上间歇性地收到Selenium错误(请参阅下文)。 stream程是: 加载起始页面 input一个search词 截图 点击searchbutton 截取结果的截图 错误发生在点击操作(步骤4),但最终的屏幕截图(步骤5)与此相矛盾,并显示search已启动(只能通过点击 – 某种forms的自动search没有在网站上实现)和返回结果。 错误: Curl error thrown for http POST to /session/a4ec9662-1841-4809-9680-caf532b243b7/element/2/click Operation timed out after 30001 milliseconds with 0 bytes received 堆栈: selenium/铬docker集装箱: selenium/standalone-chrome:3.0.1-germanium Facebook的PHP WebDriver: 请参阅GitHub Docker PHP: 参见GitHub 我已经find了另外一个关于这个的post,build议将这个环境variables设置为DBUS_SESSION_BUS_ADDRESS=/dev/null容器: DBUS_SESSION_BUS_ADDRESS=/dev/null ,但是这不起作用。 我们如何从代码pipe理容器: $Docker = new Docker(); $Manager = $Docker->getContainerManager(); $Container = $Manager->find($container_name); if ($Container) […]