mercredi 18 février 2015

Save tag as String in java and find in webdriver

I want to test that clicking on website logo leads to same page, but the logo has this ahref link:



<a href="/astana/" title="Главная страница" rel="index">
<img src="/img/lkz.png" width="107" height="38" alt="naimi.kz logo">
</a>


The tag itself is a link to be clicked on. I don't know how to save it as string because of quotes in the img src tag itself!


I want to save the thing and give it to findElement(By.linkText())


but it does not work!



String logo_img_src = "<img src="/img/lkz.png" width="107" height="38" alt="naimi.kz logo">" ;
WebElement logo_logo = firefox.findElement(By.linkText("<img src=\"/img/lkz.png" width="107" height="38" alt="naimi.kz logo"\>")) ;


How to work around it?


Aucun commentaire:

Enregistrer un commentaire