vendredi 27 mars 2015

Still Can't Retrieve Element by Xpath/Text in Selenium Webdriverjs

I found a couple of other issues to fix in this, but I'm back to the spot I got to yesterday. I need to find a way to pick up these elements with only text. Eventually, everything will be rewritten to use ids.


When I inspect the element in FirePath, this is what I see. Pretty ugly, and this is a dynamic page, so the absolute position of the elements in this list are not guaranteed.


.//*[@id='v-Portlet_CCEditorApplicationportlet_WAR_Portlet_CCEditor_INSTANCE_n6EMyzyYmNu2_LAYOUT_22823']/div/div[2]/div/div[3]/div/div/div/div[1]/div/div/div/div/div[1]/div[2]/div/div[2]/div[1]/table/tbody/tr[3]/td[1]/div


I have a document called MyTest. I'm trying to see if it's there:



driver.isElementPresent(By.xpath("//div[contains(.,'MyTest')]")).then(function(foundit)
{
if (foundit)
{
console.log('You forgot to delete your old document');
driver.quit();
}
else
{
console.log('Document Not there')
driver.quit;
}
});


Have also tried:



//div[contains(text(),'MyTest')


It doesn't seem to be in an iframe. I have tried switching to iframes 0 and 1.


Aucun commentaire:

Enregistrer un commentaire