Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python中执行send_键时出现问题_Python_Bdd_Python Behave - Fatal编程技术网

在python中执行send_键时出现问题

在python中执行send_键时出现问题,python,bdd,python-behave,Python,Bdd,Python Behave,我在尝试登录应用程序时遇到以下错误。所以我尝试在用户名文本框中输入用户名。这是示例步骤定义文件- username = (By.ID, 'user_name') password = (By.ID, 'user_password') signin = (By.ID, 'user_login') @given('user is logged in to the application') def step_impl(context): driver = context.browser

我在尝试登录应用程序时遇到以下错误。所以我尝试在用户名文本框中输入用户名。这是示例步骤定义文件-

username = (By.ID, 'user_name')
password = (By.ID, 'user_password')
signin = (By.ID, 'user_login')
@given('user is logged in to the application')
def step_impl(context):
    driver = context.browser
    driver.get(test_url)
    driver.maximize_window()
    driver.find_element(username).send_keys("test")
    driver.find_element(password).send_keys("test")
    driver.find_element(signin).click()
错误消息如下-

driver.find_element(username).send_keys("testing")
emote\webdriver.py", line 752, in find_element\webdriver
'value': value})['value']
emote\webdriver.py", line 236, in executeenium\webdriver
self.error_handler.check_response(response)
emote\errorhandler.py", line 192, in check_responseriver
raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: 'using' must be a string
(Session info: chrome=54.0.2840.99)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f93
4aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64)
正确的代码是:

driver.find_element(*username).send_keys("test")
driver.find_element(*password).send_keys("test")
driver.find_element(*signin).click()
正确的代码是:

driver.find_element(*username).send_keys("test")
driver.find_element(*password).send_keys("test")
driver.find_element(*signin).click()