Python browser page control

Source: Internet
Author: User

1. browser's forward and backward

1 #_*_ coding:utf-8 _*_2 #Import Webdriver Package3  fromSeleniumImportWebdriver4  fromTimeImportSleep5Driver =Webdriver. Firefox ()6Driver.get ("https://www.baidu.com/")7Sleep (5)8 Print("Visit the News page")9Driver.get ("http://news.baidu.com/")TenSleep (5) OneDriver.back ()#Browser Back ASleep (5) -Driver.forward ()#Browser Forward -Sleep (5) theDriver.refresh ()#Browser Refresh -Sleep (5) -Driver.quit ()

2. browser window Size Control

1 #!/usr/bin/env python2 #_*_ coding:utf-8 _*_3 #Import Webdriver Package4  fromSeleniumImportWebdriver5  fromTimeImportSleep6Driver =Webdriver. Firefox ()7Driver.get ("https://www.baidu.com/")8Sleep (5)9Driver.set_window_size (800,600)#Browser Settings SizeTenSleep (5) OneDriver.maximize_window ()#Browser fullscreen ASleep (5) -Driver.quit ()

Python browser page control

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.