Answer the question
In order to leave comments, you need to log in
I can't click on the domain. Why?
In the mobile version, I can not click on the domain.
In the desktop version, everything is fine.
Tell me where to dig?
from selenium import webdriver
# мобильная эмуляция
WIDTH = 360
HEIGHT = 640
PIXEL_RATIO = 3.0
UA = 'Mozilla/5.0 (Linux; U; Android 10; ru-ru; Redmi Note 9 Build/QP1A.190711.020) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.141 Mobile Safari/537.36 XiaoMi/MiuiBrowser/12.4.4-g'
mobileEmulation = {"deviceMetrics": {"width": WIDTH, "height": HEIGHT, "pixelRatio": PIXEL_RATIO}, "userAgent": UA}
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"]) # убоать палево
chrome_options.add_argument("--incognito")
chrome_options.add_experimental_option('mobileEmulation', mobileEmulation)
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get("http://www.yandex.ru")
search_string = driver.find_element_by_css_selector("input")
search_string.send_keys("Аудиосказки на ночь")
search_string.submit()
import time
time.sleep(3)
test2 = driver.find_element_by_link_text("mishka-knizhka.ru").click() # Так не получается
test3 = driver.find_element_by_css_selector ("organic__subtitle * = 'mishka-knizhka.ru'").click() # Так тоже
test4 = driver.find_element_by_css_selector (".OrganicTitle-LinkText: contains ('mishka-knizhka.ru')").click() #И так
time.sleep(3)
driver.quit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question