I'm trying to set the right xpath for using RSelenium, but I'm not very experienced in this area, so any help would be much appreciated. Since I'm not allowed to post pictures yet I have tried to add a link to a screenshot of the html: The html
I need R to scrape the dates (28-10-2020 - 13-11-2020), but so far I have not been able to set the correct xpath when using html.nodes.
I'm trying to scrape from sites like this one: https://www.boligsiden.dk/adresse/topperne-9-3-33-2620-albertslund-01650532___9__3__33
I usually do this on python rather than R
As you can see in this image when you right-click on the element concerned. You get a drop-down menu with an x-path to the element.
Other than that, the site orientation and x-path might change and a full x-path might be a good option in the short-run, so I rather prefer driver.find_element_by_xpath('//button[contains(text(),"Login")]') .click()
driver.find_element_by_xpath('//button[contains(text(),"Login")]') .click()
In your case which would be find_element_by_xpath('//*[contains(@class, 'u-pb-4 u-block')]')
find_element_by_xpath('//*[contains(@class, 'u-pb-4 u-block')]')
I hope this helps and it is mostly the same across different languages
2.1m questions
2.1m answers
60 comments
57.0k users