Home > other >  Find_element_by_xpath dynamic ID is invalid
Find_element_by_xpath dynamic ID is invalid

Time:11-07

 
Element=driver. Find_element_by_xpath (".//label/text ()='individual'] ")
Ticket_id=element. Get_attribute (" for ")
Print (ticket_id)
Check=driver. Find_element_by_xpath ("./*//input [@ id='{}'] ". The format (ticket_id))
Print (check. Get_attribute (" ID "))
Check the click ()
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Ctl00_ContentPlaceHolder1_chklstDiscounttypee_0
Ctl00_ContentPlaceHolder1_chklstDiscounttypee_0

Check. Click () a failure,
 
Driver. Find_element_by_xpath ("./*//input [@ id='ctl00_ContentPlaceHolder1_chklstDiscounttypee_0] "). Click ()

Is successful, very strange,
  • Related