The Python foundation of selenium automation

Source: Internet
Author: User

Selenium is an automated testing framework for UI-layer web-side, and is currently the most popular automated testing framework on the market.

Let's start with the basics:

1  fromSelenium Import Webdriver2 Import Time3 4Driver =Webdriver. Firefox ()5 6 #浏览器最大化7 # Driver.maximize_window ()8 #自定义浏览器的宽和高9# driver.set_window_size (666,555)Ten  OneURL ="http://www.cnblogs.com/hanxiaobei/" ADriver.Get(URL) -Time.sleep (5) -Print"website Title", Driver.title) the  - #并保存 -Driver.get_screenshot_as_file ("1.png") #不添加路径会自动保存在当前运行目录下 -  + #刷新 - Driver.refresh () +  ATime.sleep (3) atDriver.Get("http://www.baidu.com") -Print"title of the website", Driver.title) -  - driver.back () #后退 - Driver.forward () #前进 -  in driver.close () #关闭页面, the process is still -# driver.quit () #关闭浏览器, Process kills

The Python foundation of selenium automation

Related Article

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.