The link that I want to click I am new to Selenium. Spent almost an hour on this. What is the correct way to click on this link with Selenium?
Asked
Active
Viewed 43 times
1
-
What link ? What have you tried till now ? – RishabhHardas Jun 04 '20 at 05:32
-
1Added the image. Check now. I was trying xpath and css selectors – TANAY JOSHI Jun 04 '20 at 05:33
-
I see this is a moneycontrol link.... You can try driver.findElement(By.linkText("Annual Report")).click() Refer https://devqa.io/selenium-click-link-by-href/ – RishabhHardas Jun 04 '20 at 05:36
-
https://stackoverflow.com/questions/18597735/clicking-on-a-link-via-selenium – RishabhHardas Jun 04 '20 at 05:39
-
Actually you can get the ```link``` and then use ```driver.navigate(link)``` to move into that page. – EnriqueBet Jun 04 '20 at 05:50
1 Answers
0
Use the below xpath using text() or title
- Xpath=//a[text()='Annual Report']
- Xpath=//a[@title='Annual Report ']
- Xpath=//a[contains(@title,'Annual Report')]

Manisha Singh
- 35
- 4