Open stdex opened 9 years ago
from selenium import webdriver
import time
# Set up the Selenium WebDriver (you may need to install the appropriate driver for your browser)
driver = webdriver.Chrome()
# Open the initial URL
initial_url = "https://m.avito.ru/sankt-peterburg/predlozheniya_uslug/almaznoe_burenie_almaznaya_rezka_usilenie_79225740"
driver.get(initial_url)
# Wait for the page to load completely (you may need to adjust the wait time)
time.sleep(5)
# Find the phone link and click it
phone_link = driver.find_element_by_css_selector(".action-show-number")
phone_link.click()
# Wait for the AJAX request to complete (you may need to adjust the wait time)
time.sleep(5)
# Extract the phone number
phone_number = driver.find_element_by_css_selector(".js-item-phone-number").text
print("Phone number:", phone_number)
# Close the browser
driver.quit()
Hello. I'm try to emulate simple ajax request.
Scheme:
It' must return json:
{phone: "8 xxx xxx-xx-xx"}
But return
None
for me. I'm suggest that the cause - cookies. Can someone help me with it?