【发布时间】:2018-04-28 07:41:43
【问题描述】:
我尝试过使用 Webelement 来存储价值,但是 面临如下错误: [下面是我想要获得价值的图像,即 K1]
我没有通过 Weblement 获得价值,因为它显示错误为
org.openqa.selenium.InvalidSelectorException: The given selector //div[2]/label/strong/following-sibling::text()
is either invalid or does not result in a WebElement.
我只想将值存储在变量中并打印出来,我尝试了下面的代码但没有结果:
WebElement Key = driver.findElement(By.xpath("//div[2]/label/strong/following-sibling::text()")); 字符串与 =Key.getText(); System.out.println("键名..!!!" + vs);
建议我的意见
【问题讨论】:
-
请编辑您的问题....
-
我在您分享的
HTML中没有看到<input>标签,您能否更新包含标签的问题?你也可以用class=form-group扩展第一个div