Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找不到包含Selenium Webdriver和Python的元素_Python_Selenium Webdriver - Fatal编程技术网

找不到包含Selenium Webdriver和Python的元素

找不到包含Selenium Webdriver和Python的元素,python,selenium-webdriver,Python,Selenium Webdriver,我在Python中使用SeleniumWebDriver,遇到了一个找不到元素的问题。我试图在表中选择h2元素(或其包含的div): <table class="TabStrip" cellspacing="0" cellpadding="0" border="0" style="padding-top: 0px;"> <tbody> <tr> <td style="white-space: nowrap;vertical-align:bottom;"&

我在Python中使用SeleniumWebDriver,遇到了一个找不到元素的问题。我试图在表中选择h2元素(或其包含的div):

<table class="TabStrip" cellspacing="0" cellpadding="0" border="0" style="padding-top: 0px;">
<tbody>
<tr>
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
<td style="white-space: nowrap;vertical-align:bottom;">
    <div class="TabInactive"> </div>
    <div class="TabNotSelected" onmouseout="previousSibling.className='TabInactive'" onmouseover="previousSibling.className='TabActiveRIA'" tabindex="10" onblur="blurTab(event);" onfocus="focusTab(event);" onkeydown="postBackOnEnter(event, 'b$_tab-flexiKB01P112', null, '1', 'TAB|b$_tab-flexiKB01P112');" onclick="postBackOnEnter(event, 'b$_tab-flexiKB01P112', null, '0', 'TAB|b$_tab-flexiKB01P112');" data-name="b$_tab-flexiKB01P112" style="white-space: nowrap" role="tab" aria    -expanded="false">
        <h2 class="PageTabTitleNotSelected">Workflow Approval</h2>
    </div>
</td>
<td class="TabFiller" style="width:100%;"> </td>
</tr>
</tbody>
</table>
要选择行,一切正常。但当我尝试添加单元格时:

cell = wait.until(ec.presence_of_element_located(
        (By.XPATH, '//table[@class="TabStrip"]/tbody/tr[1]/td[15]')))
或者它里面的任何东西,我得到一个超时,并且找不到元素

我想要的内容在浏览器中清晰可见。你知道我哪里会出错吗

编辑

在Selenium IDE中,一切都可以正常工作,使用:

<tr>
    <td>clickAndWait</td>
    <td>//td[15]/div[2]</td>
    <td></td>
</tr>

单击并等待
//td[15]/div[2]

这对于任何单元格都是失败的,不仅仅是第15个单元格。该表是否加载了AJAX交互?你能尝试在不使用任何等待条件的情况下检索h2元素吗?是的,这是一个商业产品(不是我的!!),到处都有AJAX。我必须使用等待才能在页面上获取任何内容。我尝试过等待行可用,插入隐式等待,然后查找单元格,以防稍后使用某些AJAX foo添加这些单元格。这里也没有欢乐。@Owen您确定第一行至少有15个
td
元素吗?
<tr>
    <td>clickAndWait</td>
    <td>//td[15]/div[2]</td>
    <td></td>
</tr>