简体   繁体   中英

How to acheive cross browser testing using Pytest

Can someone help me how to run cross browser testing using pytest. Basically i want to run my testcases in chrome, firefox and edge parallely at once. I was now able to run individually now but i want to run in all 3 browsers at once. Please provide the steps to acheive this.

You need to use Selenium with Selenium Python Api . You can create 3 instances of drivers, one for the browser, and run in the same computer, or you can setup a Selenium Grid in order to run the same code in different computers with different browser (for advanced users).

How to run parallel test cases: you can use pytst-xdist package for this. You first need to install pytest-xdist using pip install pytest-xdist After that, from your tests folder run pytest -n=2, this command will invoke two test cases parallelly in two separate browser, use n= to specify number of parallel browser you want to run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM