Webdriver - 嵌入在Image中的URL的Xpath

时间:2015-03-31 07:51:49

标签: java selenium-webdriver webdriver

我想为员工功能自动上传个人资料照片。 但是,点击员工照片图片后会显示上传按钮,这是一个嵌入图片

的网址
<div id="profile-pic">

<h1>fg gh</h1>
  <div class="imageHolder">

  <a href="/orangehrm-3.2.1/orangehrm-3.2.1/symfony/web/index.php/pim/viewPhotograph/empNumber/0065" class="tiptip">

    <img alt="Employee Photo" src="/orangehrm-3.2.1/orangehrm-3.2.1/symfony/web/index.php/pim/viewPhoto/empNumber/0065" border="0" id="empPic" width="200" height="200">
  </a>

  </div>    
</div>

以下是员工链接中动态显示的片段。 它附有每个员工ID。

你能帮忙解决Xpath吗?

1 个答案:

答案 0 :(得分:0)

如果您知道员工编号,则可以将其设为//img[contains(@src,'0065')]其他//div[@id='profile-pic']/img