I am having problem with locating WebElement
using different locators. In the below html tag I tried locating the "write a review"WebElement
with different locators like linkText
,xpath
,classname
but still getting NoSuchElementException
-->url https://www.tripadvisor.in/
-->search for Club Mahindra
-->click on Club Mahindra
-->click on write a review
.
<a href="/UserReview-g641714-d1156207-Club_Mahindra_Madikeri_Coorg-
Madikeri_Kodagu_Coorg_Karnataka.html" target="_blank" class="ui_button
primary">Write a review</a>
Locators used
By.xpath("//*[@id="component_12"]/div/div[2]/div/div[2]/div/div[1]/a")
By.xpath("//a[@href='/UserReview-g641714-d1156207- Club_Mahindra_Madikeri_Coorg-Madikeri_Kodagu_Coorg_Karnataka.html']")
By.className("ui_button primary")
By.linkText("Write a review")
I am really confused. What am I doing wrong?