D
D
Daniil Dedinets2022-02-19 23:36:13
PHP
Daniil Dedinets, 2022-02-19 23:36:13

How to download another page through selenium?

The problem is this: you need to take info from the site https://kinosmena.ru/release/11011 for example, BUT you need to look at the sessions for tomorrow, I open the page through selenium, click on the tomorrow button and how can I download the changed page, not the old one, here function code

def on_button(url):
     browser = webdriver.Chrome(
        executable_path="path")
     browser.get(url)
     sleep(2) # Что бы кнопки загрузились
     element = browser.find_elements(By.CLASS_NAME, 'calendar__date')
     close_but = browser.find_element(By.CLASS_NAME, 'button') # Закрытие уведомления #о ковид
     #browser.execute_script("arguments[0].click();", element[1])
     webdriver.ActionChains(browser).move_to_element(close_but).click(close_but).perform() # #Закрытие этого уведомления
     webdriver.ActionChains(browser).move_to_element(element[1]).click(element[1]).perform()
     print('END')
     html = # Вот что сюда нужно вписать?
     browser.quit()
     print(BeautifulSoup(html, 'lxml').findAll('div', {'class':'seance-item__hall'})) # Должен вывести все залы,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-02-19
@donko1

Yes driver.page_source, which returns a non-rendered page
code

driver.execute_script("return document.getElementsByTagName('html')[0].innerHTML")
which returns innerHTML

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question