Selenium python grid

Source: Internet
Author: User
Tags selenium python

Learning Automation has always been in the native operation, feeling that this can reduce the amount of work really very little. Recently, we studied distributed operations.

The idea was that I started the script on a single machine, and then let the script run on different versions of the browser on different machines.

Things to prepare for:

1, JDK, and environment variables are configured well. Run Javac under cmd If you don't get an error.

2, Python development environment.

3. Selenium Installation

4, download the Selenium-server-standalone-2.45.0.jar package. This version of my own view, I use this version, mainly with 46 error

Everything is ready, I use three machines. 60 machine As I run the script machine, 89, 162 are platform.

First, (I follow the online method seems to have failed.) Finally I was on 60 this machine will switch to the folder where my jar package is located in the command Line CMD window, and then execute the command: Java-jar selenium-server-standalone-2.45.0.jar-role hub (Java-jar Sele Nium-server-standalone-2.45.0.jar-port 4000-role hub-nodetimeout 600) He has a default of 4444 ports, which can be defined by itself, this is the Boot center node, I think it's the machine that runs the script.

Second, start node: Same cmd switch to jar package directory. Java-jar selenium-server-standalone-2.45.0.jar-10.2.4.60-port 4002-role Webdriver-hub Http://10.2.4.60:4000/grid/ Register-browser Browsername=firefox,platform=windows This specifies the execution of the browser as well as the platform. You can not-browser the back. (Selenium server was started when the hub node was started)

Third, in the Center Node machine Browser Input http://localhost:4000/grid/console View link information, if there is node machine information then correct

Fourth, the United Tune, see in the Center node execution script can run on node machine, I have been here for a long time not to, directly paste the case code:

  

__author__='PC' fromSelenium.webdriverImportRemote fromSelenium.webdriver.common.desired_capabilitiesImportdesiredcapabilitieslist=['Http://10.2.4.89:4002/wd/hub','Http://10.2.4.162:4001/wd/hub'] forHostinchList:driver= Remote (command_executor=Host, Desired_capabilities=Desiredcapabilities.firefox) Driver.get ('http://www.baidu.com') driver.find_element_by_id ('kw'). Send_keys ('Selenium python') driver.find_element_by_id ('su'). Click () driver.quit ()

I struggled for a long time to tune in, there are a lot of places to expand, but I think as long as the debugging through everything to say.

  

Selenium python grid

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.