selenium python: How do I find every email on a webpage? -
the website doesn't show email addresses text, there buttons open email box, email addresses shown in source code.
each email in type of html code:
<a onclick="cc('palthoff@mcpaz.com', '', '','','');" href="#"><img src="/cpd/images/icons/email_yellow_sm.gif" border="0"></a>
i can element xpath:
email = browser.find_element_by_xpath("//*[@id="row2fc"]/td[2]/div/a")
but when "print email.text" nothing shows up. know print text if shown on page, how print email address shown in "onclick"? onclick="cc('the email address)'
i want grab every email address website, can't figure out how print text.
your appreciated. sorry if elementary, i've google searched issue , couldn't find looking for.
to print text of email, slice string returned get_attribute
method in own answer:
emails = browser.find_elements_by_tag_name("a") x in range(0,len(emails)): code = emails[x].get_attribute("onclick") email = code[4:len(code)-17] print email
Comments
Post a Comment