Test environment preparation:
First, the test environment preparation
1, install Python
2, installation Chrom65
3, installation pycharm
4, the chromedriver.exe (browser driver files) to the following path: C: \ Users \ Administrator \ AppData \ Local \ Programs \ Python \ Python36-32 ()
5、seleninm
Open cmd, enter: pip3 install selenium
Open pycharm, the setting module is added selenium
Demand : In a website (example: Baidu) search interface "software testing" can be successfully jump out searches
Analysis steps :
1, the use of selenium open the browser
2, open the Baidu website
3, find the input box, enter "software testing"
4. Click Search
Code
1, webdriver drive for the web, where the use of Google browser, you can also use Firefox, IE and other browsers
2, find_element_by_id () is to find the elements of ID, you can also find other properties of the elements
3, send.key () is an analog keyboard input content to be searched
4, click. () Is a click