0

I try to crawl this page of crédit suisse (It's an exercice for me).

So I made this script, but I don't know how to get the data. I thought it is an iframe problem, but, it's not. Then I thought it is an AngularJS website, but I think it's not.

So my code is :

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("https://tas-creditsuisse.taleo.net/careersection/campus/moresearch.ftl?lang=fr-FR")

iframe = driver.find_element_by_xpath("//iframe[@id='ftlhiddenframe']")

thepage = driver.switch_to.frame(iframe)

webpage = ""
webpage = driver.page_source

webpage = "<body>"+webpage+"</body>"

import os
helloFile = open('C:\\Users\\Thie\\Desktop\\cs.html', 'w')
helloFile.write(webpage)
helloFile.close()

driver.close()

Somebody can give me the way to get this webpage? Thanks a lot for your help.


The solution would be to make like the firefox inspector like on the picture below (select the TBody and save it in a file):

enter image description here

3
  • It is not clear what is wrong and what you want to get. Also are you getting an error, if yes - which? Commented Sep 11, 2019 at 9:13
  • I try to get all joboffer of this page, but I can't see the HTML text to get all joboffer link. Do you have a solution ? the solution would be to make the same as Firefox inspector Commented Sep 11, 2019 at 9:17
  • How to get the TBody, because it's hidden Commented Sep 11, 2019 at 9:23

1 Answer 1

1

First of all you don't need to switch to iframe. Delete this code:

iframe = driver.find_element_by_xpath("//iframe[@id='ftlhiddenframe']")
thepage = driver.switch_to.frame(iframe)

Second, if I right understand you, you want to get all links to the jobs on the page. You can use this selector:

//span[@class = 'titlelink']/a

in code it will be something like this:

listOfAllJobLinksOnThePage = driver.find_element_by_xpath("//span[@class = 'titlelink']/a")

PS remember, you will get only 25 links, if you want more you have to go to other pages and do the same

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks ;) it works ! Thanks ! You're right, it was not clear :) I need the link to go later on the job offer page and then get and crawl the job offer.
If you are satisfied with my help, you can upvote and/or accept my answer by clicking on the check button below upvote button

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.