internet explorer - Selenium python click on span class -
i trying automate intranet site. source code bunch of tables , consists of hundreds of codes below:
<span id="gridview1_ctl51_lblcasetype"></span> </td><td nowrap="nowrap"> <span class="fakelink" title="edit case" onmouseenter="this.focus()" onclick="editcase('286658')"> 286658</span> </td><td nowrap="nowrap">1360428-0000</td><td align="center" style="color:red;"> <span id="gridview1_ctl51_label2">13,0</span> </td><td align="center"> <span id="gridview1_ctl51_label2">8,8</span> </td><td align="center"> <span id="gridview1_ctl51_label9">r</span> </td><td> <span id="gridview1_ctl51_label6">waiting info fr. suppl.</span> </td><td> <span id="gridview1_ctl51_label11" title="1360428-0000 condensate cup<br/>price missing, please update price<br/>(enquiry name 11/1)" class="vtip">1360428-0000 co</span> </td><td> <span id="gridview1_ctl51_label12" title="please source" class="vtip">please source</span> </td><td> <span id="gridview1_ctl51_label7">fname lname</span> </td><td> <span id="gridview1_ctl51_label1"></span> </td><td> <span id="gridview1_ctl51_label8">price or delivery time missing</span> </td><td> <span id="gridview1_ctl51_label3">a21</span> </td><td> <span id="gridview1_ctl51_label10">ts6</span> </td><td> <span id="gridview1_ctl51_label5">fname lname</span> </td><td> </td>
i need capture part number 1360428-0000 , click "editcase (286658)". have 2 problems:
- use part number 1360428-0000 reference find case number 286658
- imitate click on 286658 xpath? couldn't make work.
i tried figure out problem #2 using below code no success:
def ietest(): driver = webdriver.ie("c:\\python34\\iedriverserver.exe") driver.get("http://intranet.company.com") time.sleep(3) print(driver.title) elem = driver.find_element_by_xpath('//span[contains(@onclick,"286658")]') elem.click() ietest()
any appreciated. must use ie.
this 1 possible xpath find target span
part number "1360428-0000"
:
//td[text()='1360428-0000']/preceding-sibling::td[1]/span[@title='edit case']
Comments
Post a Comment