Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/322.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 单击包含特定字符串的复选框_Python_Selenium_Beautifulsoup - Fatal编程技术网

Python 单击包含特定字符串的复选框

Python 单击包含特定字符串的复选框,python,selenium,beautifulsoup,Python,Selenium,Beautifulsoup,我试图单击包含以下代码中字符串12345-01的复选框: <tr class="dividebelow"> <td>&nbsp;&nbsp;&nbsp;12345-01&nbsp;&nbsp;</td> <td>x small</td> <td> <input class="12345_checkbox" name

我试图单击包含以下代码中字符串
12345-01
的复选框:

<tr class="dividebelow">
    <td>&nbsp;&nbsp;&nbsp;12345-01&nbsp;&nbsp;</td>
    <td>x small</td>
    <td>             
        <input class="12345_checkbox" name=“other" value=“5601" type="checkbox">                
    </td>
</tr>

    <tr class="dividebelow">
    <td>&nbsp;&nbsp;&nbsp;12345-02&nbsp;&nbsp;</td>
    <td>small</td>
    <td>
        <input class="12345_checkbox" name=“other" value="5602" type="checkbox">
    </td>
</tr>

<tr class="dividebelow”>
    <td>&nbsp;&nbsp;&nbsp;12345-03&nbsp;&nbsp;</td>
    <td>medium</td>
    <td>
        <input class=“12345_checkbox" name=“other" value="5603" type="checkbox">                   
    </td>
</tr>

12345-01  
x小
12345-02  
小的
12345-03  
中等的
我甚至没有成功地使用
BeautifulSoup
findAll(text='12345-01')
找到该字符串,而且
Selenium
find\u元素
到目前为止都不起作用

谢谢

这些非中断空格(
)也是该节点文本值的一部分。尝试:

find_element_by_xpath('//td[text() = "\u00a0\u00a0\u00a012345-01\u00a0\u00a0"]')
您可以使用以下选项选择输入:

'//td[text() = "\u00a0\u00a0\u00a012345-01\u00a0\u00a0"]/parent::*//input'
这些非中断空格(
)也是该节点文本值的一部分。尝试:

find_element_by_xpath('//td[text() = "\u00a0\u00a0\u00a012345-01\u00a0\u00a0"]')
您可以使用以下选项选择输入:

'//td[text() = "\u00a0\u00a0\u00a012345-01\u00a0\u00a0"]/parent::*//input'

谢谢,它似乎起作用了!你建议我如何选择下面的盒子?谢谢,它似乎起作用了!你建议我如何选择下面的盒子?