Unable to locate the object 'itimes' via any of the locators | Selenium Forum
M
Posted on 10/04/2016
Sir, navigate to http://timesofindia.indiatimes.com/india ----->click more----> i have to click 'itimes'


[b:1o3glx1j]Issue faced:[/b:1o3glx1j] Am unable to locate this object even after using following locators:
[b:1o3glx1j]Note[/b:1o3glx1j]:Have commented out locators.

//List<WebElement>L=new ArrayList<WebElement>();
//L=w.findElements(By.tagName("iframe"));
//System.out.println("iframes if any"+L.size());
we=w.findElement(By.xpath("//*[@id='srchsel3']"));
ww.until(ExpectedConditions.visibilityOf(we));
System.out.println("is more displayed?"+we.isDisplayed());
System.out.println("is more enableded?"+we.isEnabled());
A.click(we).build().perform();
//System.out.println("window title============="+w.getTitle());
WebElement box=w.findElement(By.xpath("html/body/div[1]/div[1]"));
//we=w.findElement(By.xpath("html/body/div[1]/div[1]/div/div[2]/a"));
System.out.println("window title============="+w.getTitle());
//we=box.findElement(By.xpath("//a[text()='iTimes']"));
//we=w.findElement(By.xpath("//a[@href='http://www.itimes.com/']"));

//we=box.findElement(By.xpath("html/body/div[1]/div[1]/div/div[10]/a"));
//we=box.findElement(By.xpath("//a[@target='_blank' and @href='http://www.itimes.com/' and @text()='iTimes']"));
//we=w.findElement(By.xpath("//div[@class='glblmain']/div[9]/a"));
we=w.findElement(By.linkText("iTimes"));
//ww.until(ExpectedConditions.visibilityOf(we));
ww.until(ExpectedConditions.elementToBeClickable(we));
w.manage().timeouts().implicitlyWait(60, TimeUnit.MILLISECONDS);
A.click(we).build().perform();

M
Replied on 11/04/2016

send me your full java file


M
Replied on 11/04/2016

Attaching file

Pls find comments in appropriate sections:


M
Replied on 11/04/2016

Sir, Issue is resolved.