1. Launch Firefox with add-on:
ProfileDir = “C:\Users\hyx\AppData\Roaming\Mozilla\Firefox\Profiles\mq7kifz3.default” profile = FirefoxProfile(profileDir) WZJ = webDriver. Firefox(profile) wzj.get(” http://… )
2. Solve infinite loading method
WZJ. Set_page_load_timeout (5) the try: WZJ. Get (” http://… .” ) the except: WZJ execute_script (” window. The stop () “). 3. Delete all browser cookies delete_all_cookies()
4. Delete the specified cookie
Delete_cookie (cookie name)
5. Close the browser
driver.close()
6. Close the browser and push the driver driver.quit()
7. Return to previous page
driver.back()
8. Maximize the browser
maximize_window()
9. Check the browser name and title
driver.name
driver.title
10. Switch browsers. Handle is different for different browsers, different tabs and different Windows. You can manipulate the Handle jump to perform various operations.
Now = wzJ. current_WINDOW_handle: obtain the current handle all= WzJ. window_handles: obtain all the handles for the handle in all Wzj.switch_to_window (handle): WzJ.switch_to_window (wzJ.window_handles [-1]) can also be used to obtain the currently open window
11. Drag the scroll bar to the bottom using JS method:
Js = “var q = document. DocumentElement. ScrollTop = 1200” js written change control properties of js = ‘var q = document. The getElementById (idddd \ \ “”); Q.s tyle. = XXX XXXX (\ “\”); ‘WZJ. Execute_script (js)
12. Click the popup window, you can randomly select a control, and then wait for the popup window to appear, simulate the keyboard press Enter. 13. Many controls are dragged to the bottom of the internal, you can click on it, and then touch your keyboard to press the direction.