New to Python/Selenium.
I’d like to search for the code 1203 in the third div, then find the following input checkbox. The below code doesn’t work.
Appreciate your help.
driver.find_element_by_xpath("//div[text()='1203']/following-sibling::td/input[@type='checkbox']").click()
<tr class="even">
<input type="hidden" name="WREC_WebGridArticle_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_20" id="WREC_WebGridArticle_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_20" value="d8bef5463edca72e2b5d764b88e5eee18df629da2ded56a275c4a84609a64cbfc54faad2eed89a01">
<td class="gridforminput" style="padding:2">
<div id="HolBoExclusionsMagasin_HolBasSousfamVte_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083" name="HolBoExclusionsMagasin_HolBasSousfamVte_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083">1012</div>
</td>
<td nowrap="" class="gridforminput">BAKE - BREAD 200G 600G</td>
<td nowrap="" class="gridforminput" valign="bottom" align="right">
<div id="HolBoExclusionsMagasin_HolBasPLU_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083" name="HolBoExclusionsMagasin_HolBasPLU_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083">1203</div>
</td>
<td nowrap="" class="gridforminput">Pain Campagne Long 400g</td>
<td nowrap="" class="gridforminput">FP</td>
<td nowrap="" class="gridforminput"/>
<td class="gridforminput" align="center" valign="bottom">
<input class="formcheckbox" type="checkbox" onfocus="LocOnFocusInput(this);" onblur="LocOnBlurInput(this);" onclick=" if (typeof HolBoExclusionsMagasin_HolExcluON_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083_OnBeforeClick == 'function') if (! HolBoExclusionsMagasin_HolExcluON_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083_OnBeforeClick(this)) return false;" id="HolBoExclusionsMagasin_HolExcluON_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083" name="HolBoExclusionsMagasin_HolExcluON_HolWebArticlesCaisse_ctl00_m_g_a26e7d54_b496_4e0f_8176_7ddab403a0c0_5637453083" value="ON">
</td>
</tr>