Answer the question
In order to leave comments, you need to log in
How to fix the parser?
Good afternoon!
Wrote the following parser.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pandas as pd
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
from tqdm.auto import tqdm
inn, datas, namess = [], [], []
def import_dates(name, inn):
search_name = driver.find_element_by_name('userFullName')
search_name.send_keys(name)
search_inn = driver.find_element_by_name('documentNumber')
search_inn.send_keys(inn)
try:
button_close = driver.find_element_by_xpath("//button[@title = 'Закрыть']") #ВОТ на этом этапе все перестает работать. Попробовал и по классу и по xpath никак не могу закрыть виджет
button_close.click()
button = driver.find_element_by_tag_name('button.form__button-submit.btn--basic')
button.click()
except:
button = driver.find_element_by_tag_name('button.form__button-submit.btn--basic')
button.click()
try:
table = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.TAG_NAME, "div.wrapper.block-content"))
).text
names = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.TAG_NAME, "p.info-title.text--card-head"))
).text
except:
table = WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.TAG_NAME, "h4.title.text--card-link"))
).text
names = 'Мы ничего не нашли'
return table, names
driver = webdriver.Chrome(executable_path='D:\chromedriver.exe')
driver.get('https:///about/security/reestr-brokerov-i-agentov')
t = import_dates(i, q)
inn.append(q)
datas.append(t[0])
namess.append(t[1])
driver.quit()
df = pd.DataFrame(inn)
df['ВИДЫ'] = datas
df['ФИО'] = namess
Message: element click intercepted: Element <button type="submit" class="form__button-submit btn--basic" data-v-1b4d1132="" data-v-7b3c43ec="">...</button> is not clickable at point (467, 476). Other element would receive the click: <iframe class="flocktory-widget" id="fl-539950" title="Flocktory widget" frameborder="0" scrolling="no" style="width: 100%; height: 100%;"></iframe>
(Session info: chrome=94.0.4606.81)
Answer the question
In order to leave comments, you need to log in
The sequence of actions:
1) Before clicking, check for the presence of an iframe widget
2) If there is, switch to an iframe with a widget
3) Click the close button in it
4) Restore the iframe context
5) Continue working
Switch to iframe :
# Xpath надо написать самому
iframe = driver.find_element_by_xpath("//iframe")
driver.switch_to.frame(iframe)
driver.switch_to.default_content()
import requests
params = {
'name': 'Иванов Иван Иванович',
'numberOrInn': '1111111111',
}
response = requests.get('https://www.rgs.ru/api/agents/checkAgent', params=params)
# {"Status":"NotFound","ErrorCorrelationIds":[],"ErrorCode":null}
print(response.text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question