def try_login(self, until=1):
"""Fill in the login form and submit. If the login panel is
not found, chack that we are already logged in."""
if self.exists('#login', until):
self.wait(EC.presence_of_element_located((By.NAME, 'username')), 2)
username_input = self.driver.find_element_by_name('username')
password_input = self.driver.find_element_by_name('password')
submit_button = self.driver.find_element_by_class_name('submit-button')
username_input.clear()
password_input.clear()
username_input.send_keys('test')
password_input.send_keys('test')
submit_button.click()
return 1
else:
return 0
评论列表
文章目录