Theres a webnovel site, noveltop (.net) and on every chapter page (of a webnovel) is a select drop down which allows you to pick the chapter to jump to.
Using selenium/python with firefox driver (or chrome) I've dumped the page source and all it shows in the html is:
<div class="c-selectpicker selectpicker_chapter chapter-selection chapters_selectbox_holder" data-chapter="chapter-892-892-bet-limit-shocking-change" data-
manga="1189459" data-type="content" data-vol="0">
</div>
So, obviously it's not being loaded/run. I have tried various solutions to try and wait for the page to load fully including...
- WebDriverWait(self.selenium_driver,10).until(EC.presence_of_element_located((By.XPATH, '//body')))
-
while True: page_state = self.selenium_driver.execute_script('return document.readyState;') print("wait4js: page state is:", page_state) if page_state == "complete": break
3.self.selenium_driver.implicitly_wait(2)
- NEW EDIT: I've also waited for the elements presence to be found, both by xpath/class and also on it's attributes, also for expected condition to the select to be clickable. The dynamic js doesn't seem to kick in , i've tried both the chrome and firefox drivers.
I can't find the elements I need to gather the options. Obviosuly its loading them in at run time and adding to the div the select and all the options.
It should look like this:
<div class="c-selectpicker selectpicker_chapter chapter-selection chapters_selectbox_holder" data-manga="1248315" data-chapter="chapter-1-invincible-after-a-hundred-years-of-seclusion" data-vol="0" data-type="content"> <label>
<select class="c-selectpicker selectpicker_chapter selectpicker single-chapter-select" style="" for="volume-id-0">
<option class="short " data-limit="40" value="chapter-1-invincible-after-a-hundred-years-of-seclusion" data-redirect="https://noveltop.net/novel/i-stayed-at-home-for-a-century-when-i-emerged-i-was-invincible/chapter-460-460-conflicts-and-chaos-part-2/">Chapter 460 - 460 Conflicts And Chaos (Part 2)</option>
Can someone teach me how to figure this out so that I can use driver.find_elements to gather all the option elements.
Is it an iframe, do I need to click on the div, run a javascript attached to an html element ? Help.... Deeply frustrated with this code weirdness!
Thank you in advance if you can help me. New to selenium so please be kind.