L
L
like_coding2020-06-17 01:58:12
Python
like_coding, 2020-06-17 01:58:12

How to parse Google Chrome popup?

Good afternoon everyone. There is a Python script that goes to this page https://www.flashscore.ru/ and using Selenium clicks on each match and displays a link from this match. Time.sleep so that the js on the page has time to load.
The problem is that when you click on the match, it is not a window that opens, but the second browser, the code of this new window does not see it, it is still on the initial page https://www.flashscore.ru/ and it turns out that a link is displayed just a site, but not from the match. How can I take a link from each match? With or without Selenium? Thanks in advance.
The code:

from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get('https://www.flashscore.ru/')
time.sleep(13)

for channel in driver.find_elements_by_css_selector(".event__match.event__match--scheduled.event__match--oneLine"):
    channel.click()
    time.sleep(13)

    link = driver.current_url
    print(link)

Conclusion:
https://www.flashscore.ru/
https://www.flashscore.ru/
https://www.flashscore.ru/
https://www.flashscore.ru/
https://www.flashscore.ru/
...
...
https://www.flashscore.ru/

And there should be links from each match in the order in which Selenium clicks (i.e. in order):
https://www.flashscore.ru/match/lUKXoAEo/#match-summary
https://www.flashscore.ru/match/OnDpq8b4/#match-summary
https://www.flashscore.ru/match/llD7mNQ3/#match-summary
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
ScriptKiddo, 2020-06-17
@ScriptKiddo

The ID property contains the ID of the match.
5eea0602befab384042244.png
In the popup window the same ID
5eea060865ed0765577469.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question