0
votes

I am new to Automation, and trying to automate a website. I was able to login to the site using webdriver, however I am unable to locate any elements on the next page.

I have tried locating it by id, name, css selector, linktext, xpath etc. I even put an explicit wait but that was of no help either.

I get the following error every time I try to locate the element:

Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"link text","selector":"Owner to Channel "}

Here is the page source detail for the above mentioned button:

Page source for the button

enter image description here

Code to locate the button:

WebElement el = driver.findElement(By.linkText("Owner to Channel "));
el.click();

Any suggestions? May be I am missing something.

1
You can try using partialLinkText for locating the element. driver.findElement(By.partialLinkText("Owner")).click();. Also, sometimes it is necessary to scroll the page until the link is visible. Hope it helps. - Harish
I tried that, still no luck! - Vaibhav Singh
Have you tried using the xpath from atleast the third parent node of the same? If also tried, can you please share the complete or partial HTML code of the page? - k.s. Karthik
@VaibhavSingh Does you HTML page has multiple frames or iframes? If so can you please try switching the frame where your you link is available. You may have this problem due to synchronization issues also, if selenium tries to find the element even before all elements on page load, there are chances of getting the error you specified. Please try using proper wait statements. - Siva
Have you tried with css: a[onclick*=navigate][onclick*=O2C] - lauda

1 Answers

0
votes

Thank you all for your suggestions.

I found that there was a frame in the page source, but it didn't have an id or name.

By hit and trial, I tried switching to the frame with id 0, and it worked!