I would like to scrape an HTML page where content is not static but loaded with javascript.
I downgrade Selenium to version 3.3.0
in order to be able to support PhantomJS (v4.9.x
does not support PhantomJS anymore) and wrote this code:
from selenium import webdriver
driver = webdriver.PhantomJS('path-to-phantomJS')
driver.get('my_url')
p_element = driver.find_element_by_id(id_='my-id')
print(p_element)
The error I'm getting is:
selenium.common.exceptions.NoSuchElementException: Message: "errorMessage":"Unable to find element with id 'my-id'"
The element I want to return is tag <section>
with a certain id
and all its subtags. The HTML content is like that:
<section id="my-id" class="my-class">...</section>