1st generation: as a Firefox plugin
1. Test set (group)
2. Test cases (team members)
The second generation: combined with the browser driver (webdriver)
Implementation: can be automated in different browsers
selenium guid : One computer for automation, considering the problem of slow efficiency, to realize the automation of multiple servers together
Step 1: Configure webdriver
self.driver = webdirver.Chrom(address)
Note: The version of the browser and the version of the webdriver must be the same
Part 2: Set the url address to which the browser will go
Explain the path to the specific browser
self.driver.get("https://www.4399.com/")
Step 3: Position the element
1.id preferred
2.name followed by
3.classname
4.tag_name
5.Xpath universal positioning to 99%
6. cssselector universal (universal preferred) positioning to 100%
7.linktext All content of the hyperlink text to be entered
8.parttext fuzzy search for hyperlinks
Step 4: Element Operations
Sele.find_elements(by.id, specific id name) + operation instruction
Instruction classification:
1. get (specific address) Jump to the corresponding page
2. Send_key fill in the corresponding content
3. Click Click the button
4. Clear to clear the data in the input box
5. Text Get the current text content
6. Getattribute Get the content of the specified attribute in the element
7. Quit the browser
8. Refresh refresh the browser
9. Back Go back to the previous page
10. Forward to the next page
11. Maximize_window maximizes the current window
12. Whether Id_display has loaded the display
13. Page_source Get the page source code
14. Save_screenshot
15. Close closes the current page-
Script example:
common problem:
1. Element positioning failed 404