问题:无法选择元素,然后执行向下箭头的键盘输入。
情况:我正在打开一个页面,进行了一些选择,并且在每个选择都由 .click() 事件执行后,我想模拟向下箭头的键盘输入。我收到异常错误,并尝试了不同的方法,但没有成功。
错误:WebDriverException: Message: u'unknown error: cannot focus element\n (Session info: chrome=30.0.1599.69)\n (Driver info: chromedriver=2.3,platform=Mac OS X 10.8.4 x86_64)'
def test_00_validation_test(self):
driver = self.driver
driver.set_window_position(0,0)
driver.maximize_window()
driver.get(self.base_url)
driver.find_element_by_id("open").click()
driver.find_element_by_id("screen_name").send_keys("user")
driver.find_element_by_id("password").send_keys("pwd")
driver.find_element_by_id("login_submit").click()
driver.find_element_by_id("card5").click()
driver.find_element_by_id("make_picks").click()
driver.find_element_by_id("team3").click()
driver.find_element_by_id("team3").send_keys("\25")
driver.find_element_by_id("team2").click()
driver.find_element_by_id("team2").send_keys("\25")
driver.find_element_by_id("submit_picks").click()
self.assertEqual("Picks Saved", self.close_alert_and_get_its_text())