-1

I have the below selenium code in python which I'm trying to run on the Zalenium grid. The code works fine and runs on Zalenium grid when I run the code after running the below docker command.

What I would like to know is what are the Custom Capabilities available for Zalenium and how can I set the same in Python. For example couple of Custom Capabilities in the below Zalenium documentation image that got referring the link Zalenium.

enter image description here

Docker Command

docker run --rm -ti --name zalenium -p 4444:4444 -p 5555:5555 -e PULL_SELENIUM_IMAGE=true -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/videos:/home/seluser/videos --privileged dosel/zalenium start --desiredContainers 2 --maxDockerSeleniumContainers 5

Code:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time

class RunChromeTests():

    def testMethod(self):
        # Below capabilities are for Zalenium
        caps = {'browserName': 'chrome',

        }
        # Initiate the driver instance
        driver = webdriver.Remote(command_executor=f'http://localhost:4444/wd/hub',
                                  desired_capabilities=caps)

        # Maximize the browser window
        driver.maximize_window()

        # Open the desired URL
        driver.get("http://www.google.com")

        time.sleep(5) # Let the user actually see something!

        # Close the browser
        driver.close()

        # Close the webdriver instance
        driver.quit()

ch = RunChromeTests()
ch.testMethod()
VISHVAMBRUTH J T
  • 602
  • 4
  • 14
  • 29

1 Answers1

1

It is just to set the in the caps dict you have shown above:

caps = {'browserName': 'chrome',
    'zal:name': 'myTestName',
    'zal:build': 'myTestBuild'    
}

and so on...

diemol
  • 613
  • 3
  • 10