Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.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
如何使用python在特定文本后使用selenium locate inpurt元素_Python_Selenium_Xpath - Fatal编程技术网

如何使用python在特定文本后使用selenium locate inpurt元素

如何使用python在特定文本后使用selenium locate inpurt元素,python,selenium,xpath,Python,Selenium,Xpath,出于某种原因 我需要在“测试”后输入一些文本 但是输入名称总是会自动更改为不同的名称,甚至是不同的格式,因此我无法通过固定的CSS或Xpath找到它 <tr class="123"><td class="456"> <div class="789">Test</div></td><td><input size="16" maxlength="15" name="ABC"></td> 但是失败了。。我

出于某种原因

我需要在“测试”后输入一些文本 但是输入名称总是会自动更改为不同的名称,甚至是不同的格式,因此我无法通过固定的CSS或Xpath找到它

<tr class="123"><td class="456">
<div class="789">Test</div></td><td><input size="16" maxlength="15" name="ABC"></td>

但是失败了。。我想我应该以错误的方式,帮助….

一个XPath来定位文本“Test”后面的输入:


您可以像这样使用以下同级轴:

//td[div='Test']/following-sibling::td[1]/input
"//div[.='Test']/following::input[1]"
//td[div='Test']/following-sibling::td[1]/input