Selenium grid node with many parallel phantomjs instances

I am trying to add a node with many parallel PhantomJS instances. On the GhostDriver github page, you can find instructions that will register one node with only one instance of PhantomJS:

phantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444

I am not allowed to post images, so here is the grid view after adding a node with the following method: enter image description here

Here is the contents of the configuration tab:

port:6666
servlets:[]
host:null
cleanUpCycle:5000
browserTimeout:0
hubHost:127.0.0.1
registerCycle:5000
hub:http://127.0.0.1:4444/grid/register/
capabilityMatcher:org.openqa.grid.internal.utils.DefaultCapabilityMatcher
newSessionWaitTimeout:-1
url:http://127.0.0.1:6666
remoteHost:http://127.0.0.1:6666
prioritizer:null
register:true
throwOnCapabilityNotPresent:true
nodePolling:5000
proxy:org.openqa.grid.selenium.proxy.DefaultRemoteProxy
maxSession:1
role:wd
jettyMaxThreads:-1
hubPort:4444
timeout:300000

Since selenium grid allows you to define node browsers from the command line, I tried to do this with phantomjs, but as you can see here it is not supported.

, -browser: browserName = {android, chrome, firefox, htmlunit, internet explorer, iphone, opera} version = { } firefox_binary = { } chrome_binary = { } maxInstances = { } platform = {WINDOWS, LINUX, MAC}

+4
2

: ( ): archtecture

: 1), selenium-server- ( UI, ffox, chrome IE)

java -jar  selenium-server-standalone-2.41.0.jar -role node -hub htt
p://localhost:4444/grid/register -port 7575 -browser  browserName=firefox,maxIns
tances=5,platform=WINDOWS

: http://gyazo.com/6cd19155c78a59b22a09f4a3da3439b5 , , , : -browser browserName = firefox, maxInstances = 5, platform = WINDOWS

, , GhostDriver phantomJs, selenium-server-.jar, phantomjs.exe, -browser: 2

phantomjs 1 phantom jsInstance 5 firefox.

, - : 1 NODE= 1 PhantomJs. reorganized test architecture

(IE, Ffox, Chrome) : http://gyazo.com/302fab9b6722251aa2cc6d98e2522931


:

IP-: 162.243.175.134 162.243.175.97 162.243.175.252 ....

public class BrowserOneInstance extends BaseMethodsForMultipleBrowsers {

    private WebDriver driver;

    private final static Logger log = LoggerFactory.getLogger(BrowserOneInstance.class);
    public static LoginPage loginPage;
    public static FacebookUserPage homePage;

    FileOperations fileManipulator = new FileOperations();


//staring   hub - nodes model (on local WIN machine) over GhostDriver- pHantomJS

    @BeforeClass
    public void seleniumGrridUponGhostDriver() throws MalformedURLException {


//        File phantomjs = Phanbedder.unpack(); //Phanbedder to the rescue!

        File phantomjs = new File(System.getProperty("java.io.tmpdir")+File.separator+"phantomjs-1.9.7");


        DesiredCapabilities dcaps = new DesiredCapabilities();
        dcaps.setCapability("takesScreenshot", true);


        dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath());

// !!!!! hardCoded initizliations of GhostDriver node
//        driver = new RemoteWebDriver(new URL("http://localhost:8080"), dcaps);

//    driver initialization   using  method  providing IP of running Ghost node connected to running hub
//        this.driver= new RemoteWebDriver(new URL("http://"+getGhostNodesIp()+":8080"),dcaps);

//        node  connected to linux hub:
        this.driver = new RemoteWebDriver(new URL("http://162.243.175.134:8080"), dcaps);


        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);

        //page instances init()
        loginPage = PageFactory.initElements(driver, LoginPage.class);
        homePage = PageFactory.initElements(driver, FacebookUserPage.class);
    }

      @Test
 public void abracadabraTestMethod(){

  ....
 }


        @AfterTest
    public void driverTearDown() {
//        close any of the instances: either Firefox or GhostDriver
        driver.quit();
    }

}

:

, phantomJs , Phanbedder - PhantomJS Windows/Mac OS X/Linux:

import net.anthavio.phanbedder.Phanbedder;

......

 @BeforeClass
    public void seleniumGrridUponGhostDriver() throws MalformedURLException {

        File phantomjs = Phanbedder.unpack(); //Phanbedder to the rescue!


        DesiredCapabilities dcaps = new DesiredCapabilities();
        dcaps.setCapability("takesScreenshot", true);


        dcaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomjs.getAbsolutePath());


        this.driver = new RemoteWebDriver(new URL("http://162.243.175.134:8080"), dcaps);

......

, .

+4

Docker: https://github.com/madhavajay/selenium-node-phantomjs

PhantomJS 2.1.1 Custom Build, Ghostdriver, -remoteHost, Grid Docker , .

, - .:)

Docker Hub: madhavajay/selenium- node -phantomjs

0

Source: https://habr.com/ru/post/1538078/


All Articles