Element is found in XPath Checker but not in Selenium

前端 未结 4 596
庸人自扰
庸人自扰 2021-01-14 18:29

I have the following XPath:

//div[contains(@id, \'box\')]/div/h4/small/a[contains(@href, \'google\')]/@href

When I try out this XPath in XP

4条回答
  •  鱼传尺愫
    2021-01-14 19:00

    You should write xpath first eg

    WebDriver_Object_name.findElement(By.xpath("...xpath...")).getAttribute("..Attri_name..");
    

    Here your WebDriver_Object_name might be selenium

提交回复
热议问题