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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -