from selenium import webdriverself.browser = webdriver.Firefox()self.browser.set_window_size(1024, 768)self.browser.get_window_size() {u'height': 638, 'value': None, u'width': 1229}
测试时这样就过了:
inputbox = self.browser.find_element_by_id('id_new_item')self.assertAlmostEqual( inputbox.location['x'] + inputbox.size['width']/2, # 512, self.browser.get_window_size().get("width")/2, delta=5)
以上就是selenium设置窗口大小不准确,终于解决的详细内容,更多请关注php中文网其它相关文章!