gpt4 book ai didi

Java:无效选择器:指定了无效或非法的选择器

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

我正在尝试点击付款弹出窗口中的一个元素:

<label data-v-533987c6="" xpath="1">Card Number:</label>
<input data-v-533987c6="" type="tel" data-mask="#### #### #### ####" data-previous-value="" xpath="1">

具有以下 xPath:

@FindBy(name = "//div[contains(@class,'买票')]//div/label[text()='卡号:']/following-sibling::input")

但我收到此错误:

org.openqa.selenium.InvalidSelectorException: invalid selector: An invalid or illegal selector was specified
(Session info: chrome=80.0.3987.87)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/invalid_selector_exception.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'DESKTOP-VQ56FMV', ip: '192.168.0.13', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_231'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 80.0.3987.87, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\Nastya\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:64958}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: 3ca3f388f2b3cf47642733a6f03...}
Session ID: 3ca3f388f2b3cf47642733a6f0383c1e
*** Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}
为什么?希望你能帮助我!

最佳答案

根据错误信息

Element info: {Using=name, value=//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input}

您正在尝试使用另一个xpath

//div[contains(@class,'buy-tickets')]//div/label[text()='Card Number:']/following-sibling::input`

By.name,这是无效的。您需要使用By.xpath

关于Java:无效选择器:指定了无效或非法的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60253065/

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