Ⅵ. Browser Connection (Web Automated Testing)¶
AirtestIDE supports connecting to the chrome browser for automated testing of web pages. It uses the Airtest-Selenium library, which is a layer of encapsulation of the python library of selenium.
2.Connecting Chrome Browser on AirtestIDE¶
1) Check the IDE's Selenium window¶
Translation: By default, the IDE does not display the Selenium window that supports Chrome. You need to find the Window button in the top menu bar of the IDE and select "Selenium Window" to make it displayed:
Later we will use the features of this auxiliary window to connect to the chrome browser.
2) Set the path of chrome.exe (chrome path)¶
Also in the top menu bar, go to Options - Settings - Selenium - chrome path, set the path of chrome.exe on your computer, and then click OK to save the settings.
3) Open the browser in the IDE and select initialization¶
In the Selenium window you just opened, click the initialization button in the shape of a globe to open the chrome browser. Then at the top of the script editor window, a bright yellow prompt will appear asking you to decide whether to insert the initialization script. Just click Yes.
This code serves to open a chrome browser. Then you can write more Airtest-Selenium scripts or selenium scripts for the automated testing on your chrome browser:
3.Common Issues with Chrome Browser Connection¶
1) The path of chrome.exe is not set.¶
If you forget to set the path of chrome.exe in the IDE's Options - Settings, then when clicking the initialization button in the selenium window, the following message will appear: "please set chrome path on options":
2) Chromedriver version does not correspond to chrome version, resulting in a startup error.¶
If you fail to bring up the chrome browser after clicking the initialization button in the IDE or running the initialization code, an error similar to the following will occur:
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Windows NT 10.0.18362 x86_64)
This is because the chromedriver version does not correspond to the chrome version. You can open the path of local chrome installation, check the local chrome version, and then go to this link to download the corresponding chromedriver into the folder:
3) IDE's support for other browsers¶
Currently AirtestIDE only supports connecting to chrome browser for web testing. More browser support can be expected in our subsequent updates.
4) Mac system does not support Airtest-Selenium¶
Currently, only Windows supports debugging of image methods encapsulated by Airtest-Selenium. Mac is not supported for the time being, and the following prompt will appear when used: "current os is not windows!you can't use airtest function of airtest-selenium":