selenium - Select all tables and exclude the div -
i'm trying stuff python , selenium can't xpath work. have following code :
<div id="ctl00_main_treecategories"> <table> <tbody> <tr> <td><a id="ctl00_main_treecategoriesn0">online catalogus</a></td> </tr> </tbody> </table> <div id="ctl00_main_treecategoriesn0nodes" style="display:block;"> <table cellpadding="0" cellspacing="0" style="border-width:0;"> <tbody> <tr> <td> <div style="width:20px;height:1px"></div> </td> <td> <a id="ctl00_main_treecategoriesn1">dakraam</a> </td> </tr> </tbody> </table> <div id="ctl00_main_treecategoriesn1nodes" style="display:block;"> <table cellpadding="0" cellspacing="0" style="border-width:0;"> <tbody> <tr> <td><div style="width:20px;height:1px"></div></td> <td><div style="width:20px;height:1px"></div></td> <td></td> <td class="treenode ctl00_main_treecategories_2"><a class="ctl00_main_treecategories_0 treenode ctl00_main_treecategories_1">dakraam duette® & plissé saaaaahade</a></td> </tr> </tbody> </table> </div> <table cellpadding="0" cellspacing="0" style="border-width:0;"> <tbody><tr> <td><div style="width:20px;height:1px"></div></td> <td></td> <td class="treenode ctl00_main_treecategories_2" style="white-space:nowrap;"> <a class="ctl00_main_treecategories_0 treenode ctl00_main_treecategories_1">duette® fixé & plissé shadeeeee</a> </td> </tr> </tbody> </table> </div> i try select tables within ctl00_main_treecategoriesn0nodes div, , exclude div on first level within (ctl00_main_treecategoriesn1nodes).
i tried :
//*[contains(@id, "ctl00_main_treecategoriest")]/div/table/ but gives syntax error.
you had 2 errors on xpath:
- mispelling of id (that
t@ end) trailing / (not necessary)
//*[contains(@id, "ctl00_main_treecategories")]/div[not(@id="ctl00_main_treecategoriesn1nodes")]/table
demo: https://3v4l.org/susiz
edit: excluded inside ctl00_main_treecategoriesn1nodes divs
Comments
Post a Comment