jeudi 27 août 2015

xpath does not get the web element which has multiple classes

I am very new at Java and Selenium so my apologies in advance if my question sounds a bit primary.

I am using Selenium and Java to write tests. But have issue with finding elements. I know some other ways to find this WebElement,

but why this:

WebElement we1 =driverChrome.findElement(By.xpath
("//div[contains(@class,'elfinder-cwd-filename ui-draggable') and @title='project.CPG']"));

can not get this:

<div class="elfinder-cwd-filename ui-draggable" title="project.CPG">project.CPG</div>

and shows this error:

Exception in thread "main" org.openqa.selenium.NoSuchElementException: no 
such element: Unable to locate element:{"method":"xpath","selector":"
//div[contains(@class,'elfinder-cwd-filename ui-draggable') and @title='project.CPG']"}

Aucun commentaire:

Enregistrer un commentaire