我想使用Selenium自动登录网站https://clientes.ecuabots.com/user/login
这是我的代码:
class EcuabotsTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path='/mnt/c/Users/Barbara/Documents/Formación Continua/Selenium/chromedriver.exe')
driver = self.driver
driver.get('https://clientes.ecuabots.com/user/login')
driver.maximize_window()
#driver.implicitly_wait(15)
def test_search_email_input(self):
email_field = self.driver.find_elements_by_xpath('//*[@id="input-15"]')
email_field.clear()
email_field.send_keys('email@email.com)
if __name__ == "__main__":
unittest.main(verbosity=2)
但是当我尝试这种方法时,我出现了一个错误:AttributeError'list'对象没有属性send_键
我试图使用email_field=self.driver.find_element_by_xpath('/[@id=“input-15”]”)(单数),但我得到了以下错误:selenium.common.exceptions.NoSuchElementException:Message:没有这样的元素:{“方法”:“xpath”,“选择器”:“/[@id=“input-15”]”
我用id、CSS选择器和完整的XPath尝试了查找电子邮件输入,但不起作用
我尝试使用电子邮件\u字段[0]。发送\u密钥('0')email@email.com)但我又犯了第一个错误
事先非常感谢您的帮助
find_element_by_xpath
,而不是find_elements_by_xpath
试试这个:
相关问题 更多 >
编程相关推荐