Reputation: 43
I am scraping a job board (eluta.ca) using Python and Selenium.
I'm able to return everything I want except for the link to the extended job description. In the bit of HTML below the job "Claims Adjuster"; links to "http://www.eluta.ca./direct/p?i=f1a7daa360e9468d5837d821c9d328ec"
<h2 class="title">
<span class="lk-job-title" title="Claims Adjuster" onclick="enav2('./direct/p?i=f1a7daa360e9468d5837d821c9d328ec')"></span>
</h2>
I can find the element using the code
webdriver.find_element_by_css_selector("#organic-jobs .organic-job:nth-child("+str(Line)+") .title .lk-job-title")
retrieve the job via .text, navigate to the extended description via .click()
Am I missing sometingh obvious that would return all or part of "enav2('./direct/p?i=f1a7daa360e9468d5837d821c9d328ec')"
Thanks in advance
Upvotes: 1
Views: 2417
Reputation: 473893
Use .get_attribute()
:
element = webdriver.find_element_by_css_selector("#organic-jobs .organic-job:nth-child("+str(Line)+") .title .lk-job-title")
print element.get_attribute('onclick')
Upvotes: 2