无法点击,错误是:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//span[text()='prpse1']"}
HTML:
<span class="lbl ui_lbl_radio custom-control-description">Business</span>
答案 0 :(得分:0)
要单击文本为 Business 的元素,可以使用以下Locator Strategy:
xpath :
//span[@class='lbl ui_lbl_radio custom-control-description' and text()='Business']
答案 1 :(得分:0)
要单击元素,可以使用CSS选择器方法,如下所示:
driver.findElement(By.cssSelector(“ span.lbl ui_lbl_radio custom-control-description”))。click();