Код: Выделить всё
stocks = ['https://www.bvc.com.co/renta-variable-mercado-local/cibest?tab=operaciones',
'https://www.bvc.com.co/renta-variable-mercado-local/pfcibest?tab=operaciones',
'https://www.bvc.com.co/renta-variable-mercado-local/bogota?tab=operaciones',
'https://www.bvc.com.co/renta-variable-mercado-local/bhi?tab=operaciones',
'https://www.bvc.com.co/renta-variable-mercado-local/celsia?tab=operaciones']
import selenium, time
import selenium.webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
driver = selenium.webdriver.Chrome()
useless_frame = False
for i in stocks:
print(i)
#driver = selenium.webdriver.Chrome()
driver.get(i)
if not useless_frame: #closing a useless frame
bvc_frame = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, '.sc-843139d2-14.iwukQD')))
if bvc_frame:
bvc_frame.click()
useless_frame = True
time.sleep(1)
target = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '//*[@id="__next"]/div/div[3]/div[3]/div/div[1]/ul/li[3]')))
driver.execute_script("arguments[0].scrollIntoView()", target)
time.sleep(1)
Подробнее здесь: https://stackoverflow.com/questions/796 ... ank-screen
Мобильная версия