Python Learning-python webdriver API

Source: Internet
Author: User

#1. Import the Webdriver package from selenium import webdriver#2. Open the browser, open the website browser = webdriver. Firefox () browser.get ("https://www.baidu.com") #3. The browser maximizes the Browser.maximize_window () #4. Customizing the browser window size Browser.set_window _size (700,800) #5. Close the browser browser.quit () #6. Browser forward back First_url = ' https://www.baidu.com/' Second_url = ' https:// News.baidu.com ' Browser.get (first_url) browser.get (Second_url) browser.back () #后退browser. Forward () #前进 # #. Object Positioning Find_ ELEMENT_BY_ID () #常用find_element_by_name () #常用find_element_by_class_name () #用class属性定位find_element_by_tag_name () # Easy to repeat, not very practical find_element_by_link_text () #通过文字链接定位find_element_by_partial_link_text () #通过部分文字链接定位find_element_by_ Xpaht () #常用find_element_by_css_selector () #不太理解, need to review #对象定位后常用方法: Clear ()  Send_keys ()   Click ()  

Python Learning-python webdriver API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.