2017-03-05 4 views
0

Hey Ich habe folgende HTML-Code ich in Python Selenium Bibliothek zu kratzen bin versucht:Selen Python Kein Element Name

Event ID: <font color='blue'>8YG411</font> 
    Action - Citation/Fine 
    Notice to facility: <font color='blue'>12/18/2013</font> 
      Appeal: <font color='blue'>N/A</font> 
    Action Cease/Recind: <font color='blue'>1/28/2014</font> 
     Case Closed: <font color='blue'>1/28/2014</font> 
    Initial Amount: <font color='blue'>$2500</font> 
Event ID: <font color='blue'>PUJU11</font> 
    Action - Citation/Fine 
    Notice to facility: <font color='blue'>10/28/2011</font> 
      Appeal: <font color='blue'>N/A</font> 
    Action Cease/Recind: <font color='blue'>5/22/2012</font> 
     Case Closed: <font color='blue'>5/22/2012</font> 
    Initial Amount: <font color='blue'>$2000</font> 

ich als nächstes Geschwister Element von Ereignis-ID versucht haben, das eigentliche Ereignis-ID mit nicht zu bekommen Erfolg. Es gibt auch eine veränderliche Struktur für den XPath für die Ereignis-ID von Seite zu Seite. Lass es mich wissen, wenn jemand irgendwelche Gedanken hat. Die Seite ist hier: http://www.in.gov/isdh/reports/QAMIS/ltccr/cr004353.htm

Mein Versagen Code unten:

loopNum = browser.find_element_by_xpath("//*[contains(., \""+ "Event ID" +"\")]/following-sibling::*") 

Antwort

0

Für Ihre Verwendung HTML-Struktur XPath folgende id 8YG411

browser.find_element_by_xpath("//table[@summary='Enforcement Actions']/following-sibling::font[1]").text 
+0

Dank zu erhalten! Das war perfekt! –