L
L
lancerok2021-07-04 21:27:44
Python
lancerok, 2021-07-04 21:27:44

python selenium. Help with yandex pagination?

The essence of the question I can not understand how to implement a search on the pages of Yandex.
You need to find the site and go to it.
The site is at about 28th place. Often positions jump.

Help implement.

from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get("http://www.yandex.ru")
search_string = driver.find_element_by_id("text")
search_string.send_keys("Аудиосказки на ночь")
search_string.submit()

test1 = driver.find_element_by_css_selector('.pager__item_kind_next').click()  # Нажать кнопку следующая страница.
test2 = driver.find_element_by_link_text("audiobaby.ru").click()

time.sleep(3)
driver.quit()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mihoe9, 2021-09-12
@Mihoe9

You can try to implement through BeautifulSoup and Request

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question