gpt4 book ai didi

selenium - Behat 我按 "Button"不工作

转载 作者:行者123 更新时间:2023-12-05 01:48:09 25 4
gpt4 key购买 nike

我在登录表单中有一个提交按钮,即“登录”。输入字段如下所示

<input name="submit" type="submit" value="Log In">

当我按下按钮“登录”提交登录表单时,出现以下错误

    Exception thrown by (//html/.//input[./@type = 'submit' or ./@type = 'image' or ./@type = 'button'][(((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(./@title, 'submit'))] | .//input[./@type = 'image'][contains(./@alt, 'submit')] | .//button[((((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(normalize-space(string(.)), 'submit')) or contains(./@title, 'submit'))] | .//input[./@type = 'image'][contains(./@alt, 'submit')] | .//*[./@role = 'button'][(((./@id = 'submit' or ./@name = 'submit') or contains(./@value, 'submit')) or contains(./@title, 'submit') or contains(normalize-space(string(.)), 'submit'))])[1]
Element must be displayed to click (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 44 milliseconds
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows Server 2008 R2', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_35'
Session ID: a5c41be673ac14346462e1bf99f60995
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, chrome.chromedriverVersion=26.0.1383.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=27.0.1453.110, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]

我的步骤如下

  Given I am on "/"
And I wait for "Log In"
And I hover on "Log In"
And I wait for "Log In"
When I fill in "LoginForm_username" with my username
And I fill in "LoginForm_password" with my password
And I press "submit"

最佳答案

我已经修改了下面的代码,现在可以正常工作了

$page = $this->getSession()->getPage();
$element = $page->find('css',"#formid input[value=\"Log In\"]");
$element->doubleClick();

关于selenium - Behat 我按 "Button"不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17469966/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com