from selenium import webdriver
self.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
)
网友评论