如何使用span标记为html代码编写xpath

时间:2015-08-20 09:57:35

标签: python xpath pycharm

请找到以下HTML代码:

<tbody>
  <tr>
    <td align="left" style="vertical-align: top;">
      <table cellspacing="0" cellpadding="0">
        <tbody>
          <tr>
            <td align="left" style="vertical-align: top;">
              <button id="gwt-uid-1128" class="gwt-Button mlsButton mlsButtonOk mlsButtonSmall" type="button" style="min-width: 50px;cursor:pointer;">
                <span>New project</span>
              </button>
            </td>
          </tr>
        </tbody>

我已经写了“新项目”的xpath编写为xpath=.//span[text()='New project'],我已经在PyCharm中编写了Python脚本,如下所示:

Wait Until Page Contains    xpath=.//span[text()='New project']
Click Button    xpath=.//span[text()='New project']

但我收到错误声明:

Text 'xpath=.//span[text()='New project']' did not appear in 5 seconds

我可以知道问题是什么,我应该怎么做才能纠正上面的xpath?

0 个答案:

没有答案