Selenium webdriver 我无法使用标记a和ng click获取元素的xpath<;a类=";项目「;ng click=";setCurrentScreen(';Contacts';)"&燃气轮机; WebElement contact_view=driver.findElement(By.xpath(//a[@ng click='setCurrentScreen('Contacts')')));

Selenium webdriver 我无法使用标记a和ng click获取元素的xpath<;a类=";项目「;ng click=";setCurrentScreen(';Contacts';)"&燃气轮机; WebElement contact_view=driver.findElement(By.xpath(//a[@ng click='setCurrentScreen('Contacts')')));,selenium-webdriver,Selenium Webdriver,请帮助我获取此元素的xpath 下面是我的HTML代码 <a class="item" ng-click="setCurrentScreen('Contacts')"> WebElement contact_view= driver.findElement(By.xpath("//a[@ng-click='setCurrentScreen('Contacts')']")); 此标记a和ng单击 我认为定位器中的引号有问题。试着这样做: <a class="item" n

请帮助我获取此元素的xpath

下面是我的HTML代码

<a class="item" ng-click="setCurrentScreen('Contacts')">


WebElement contact_view= driver.findElement(By.xpath("//a[@ng-click='setCurrentScreen('Contacts')']"));

此标记a和ng单击

我认为定位器中的引号有问题。试着这样做:

<a class="item" ng-click="setCurrentScreen('Contacts')">
 <img ng-src="img/clutto/Contacts_Icon_Selected.png" 

src="img/clutto/Contacts_Icon_Selected.png"> </a> this tag a and ng click
WebElement element = driver.findElement(By.xpath("//a[@ng-click=\"setCurrentScreen('Contacts')\"]"));