Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.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
Vba Selenium-从网站表中提取数据并将其分配给变量_Vba_Selenium_Xpath_Selenium Webdriver - Fatal编程技术网

Vba Selenium-从网站表中提取数据并将其分配给变量

Vba Selenium-从网站表中提取数据并将其分配给变量,vba,selenium,xpath,selenium-webdriver,Vba,Selenium,Xpath,Selenium Webdriver,我试图从网站中提取一个值和一个标题(字符串),但无法使用selenium找到元素 我的代码 我使用Firebug获取XPath,它决定了: //*[@id="DimensionForm"]/p[1]/table/tbody/tr[3]/td[3] 代码 HTML代码 <form id="DimensionForm" name="validate" action="Dimension" method="post"> <div style="margin-top: 7px"&g

我试图从网站中提取一个值和一个标题(字符串),但无法使用selenium找到元素

我的代码
我使用Firebug获取XPath,它决定了:

//*[@id="DimensionForm"]/p[1]/table/tbody/tr[3]/td[3]
代码

HTML代码

<form  id="DimensionForm" name="validate" action="Dimension" method="post">
<div style="margin-top: 7px"></div>
<p><table width="100%" cellspacing="0" border="0" cellpadding="0" class="element">
<tr>
<td>&nbsp;</td><td class="formtitlenobg" colspan="6" align='right'>
AREA DIMENSIONS&nbsp; &nbsp; &nbsp; (AREA&nbsp;A) <span class='quote'> &nbsp; Front</span> 25.24</td>
</tr>
<tr align="right">
<td class="tablerowlightgreen" width=10>&nbsp;</td>
<th class="formtitle"  width=250 align="left">Property</th>
<th class="formtitle" width=50>Check</th>         <th class="formtitle" width=75>Front</th>
<th class="formtitle" width=75>Center</th><th class="formtitle" width=75>Left</th>
<th class="formtitle" width=120>Right</th>
<th class="formtitle" width=100>Total</th>
<td class="tablerow" width=50>&nbsp;</td>
<td class="tablerow">&nbsp;</td>
</tr>
<tr align="right" nowrap>
<td>&nbsp;</td>
<td class="table" align="left"><strong>
Property&nbsp;O</strong></td>
<td class="table">+</td>
<td class="table">10</td>
<td class="table">12</td>
<td class="table"><strong>12</strong></td>
<td class="table"><strong><font class="front">
100</font></strong></td>
<td class="table">120</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr></table>


面积尺寸(面积A)前25.24
财产
正面检查
中间偏左
赖特
全部的

财产O
+
10
12
12

100
120

您的引号嵌套不正确:

selenium.findElementByXPath("//*[@id="DimensionForm"]/p[1]/table/tbody/tr[2]/td[3]")
也许你的意思是:

selenium.findElementByXPath("//*[@id='DimensionForm']/p[1]/table//tr[2]/td[3]")

注意第二行中的单引号

当您尝试代码时发生了什么?什么都没有,还是例外?如果它是一个异常,你能编辑你的问题并添加异常吗?似乎在你的html末尾有额外的
,你缺少

,我试过了,它仍然不起作用。不过谢谢你的提示。删除“tbody”,因为某些浏览器不会呈现该元素。
selenium.findElementByXPath("//*[@id='DimensionForm']/p[1]/table//tr[2]/td[3]")