How to write xpath in pycharm

2019-09-09 21:47发布

I have a absolute xpath:

html/body/div[3]/div[4]/div/div[3]/div/div[3]/div/div[3]/div/div[3]/div/div[2]/div/div[2]/div/div[6]/div/div[5]/div/div[1]/div/div[2]/div[3]/div/div/div/table/tbody/tr[2]/td[2]

and the html code is:

<div class="GGHMD25BMQH">
<table class="GGHMD25BJKC" style="width: 100%; cursor: pointer">
<tbody>
<tr>
<tr class="GGHMD25BHKC" recordid="100000001301800">
<td class="innerCell" cdn="0">
<td id="gwt-uid-660" class="innerCell" cdn="1" hover-area="true">Product Concept</td>
<td class="innerCell" cdn="2" hover-area="true">Comfort</td>
<td id="gwt-uid-662" class="innerCell" cdn="3" hover-area="true">Implantable Glucose Sensor</td>
<td id="gwt-uid-665" class="innerCell" cdn="4" hover-area="true">Glucose readings without painful finger sticks</td>
<td class="innerCell" cdn="5" hover-area="true">Implantable Sensor Concept Screener Q4</td>
<td class="innerCell" cdn="6" hover-area="true">Oct/2010</td>
<td class="innerCell" cdn="7" hover-area="true">
</tr>

I want to write an xpath in pycharm to identify this line : <td id="gwt-uid-660" class="innerCell" cdn="1" hover-area="true">Product Concept</td>

标签: xpath pycharm
1条回答
Evening l夕情丶
2楼-- · 2019-09-09 22:29

Since commonly id is unique, you can try to identify the element by id :

//td[@id='gwt-uid-660']
查看更多
登录 后发表回答