<a href="https://www.pharmacistexcellence.com/index/aboutpep#pepLinkSection">
<img class="iconBulletLink" style="vertical-align:middle; position: relative; top: -1px;" src="https://www.pharmacistexcellence.com/assets/images/icon-bullet.png" width="25">
</a>
<div style="vertical-align:middle; display:inline;" class="anchr sixthAnch beforeAnch afterAnch">
About PEP
</div>
我可以使用哪种类型的定位器?
答案 0 :(得分:0)
根据您共享的 HTML 点击链接,您可以使用以下任一定位策略( Java perspective ):
cssSelector :
driver.findElement(By.cssSelector("a[href='https://www.pharmacistexcellence.com/index/aboutpep#pepLinkSection']>img.iconBulletLink")).click();
xpath :
driver.findElement(By.xpath("//a[@href='https://www.pharmacistexcellence.com/index/aboutpep#pepLinkSection']/img[@class='iconBulletLink']")).click();