1.设置浏览器大小:
WebDriver 提供了 set_window_size() 方法来设置浏览器的大小
maximize_window()方法,设置全屏幕
例:
browser.set_window_size(480,960)
print "the window size is 480*960"
time.sleep(2)
browser.maximize_window()
time.sleep(1)
2.控制浏览器后退、前进
前进:browser.forward()
后退:browser.back()
browser = webdriver.Firefox()
i="https://www.baidu.com/"
l="https://www.nuomi.com/?cid=002540"
browser.get(i)
print 'current %s' %i
browser.get(l)
print 'current %s' %l
time.sleep(1)
browser.back()
print 'back to i'
time.sleep(1)
browser.forward()
print 'forward to j'
time.sleep(1)
browser.quit()