How to extract data with selenium from a website?

Funzel

I'm trying to extract some data with selenium and python from a website. Here is some code I use until now:

url = 'https://www.kicker.de/1894559/spieldaten/bayern-muenchen-14/borussia-mgladbach-15'
chrome = webdriver.Chrome()
select = Select(chrome.find_element_by_id('selOptaPlayer1'))
select.select_by_value('57598')

It is possible to open the URL, select the player on the website. But I can't extract some data from the player. I get the error that selenium can't find the xpath. With google help, the issue can be with iframes. Now my question is, how can I find out in which iframe is the data located?

SeleniumUser002

Please find below solution to select 57598 value option using option[text()='Alaba, David']

Solution 1:

from selenium import webdriver
driver = webdriver.Chrome(executable_path=r"C:\New folder\chromedriver.exe")
driver.get('https://www.kicker.de/1894559/spieldaten/bayern-muenchen-14/borussia-mgladbach-1')
driver.find_element_by_xpath("//select[@id='selOptaPlayer1']/option[text()='Alaba, David']").click()

Solution 2:

Also you can use below code for the same :

from selenium import webdriver
from selenium.webdriver.support.ui import Select


driver = webdriver.Chrome(executable_path=r"C:\New folder\chromedriver.exe")
driver.get('https://www.kicker.de/1894559/spieldaten/bayern-muenchen-14/borussia-mgladbach-1')
select.select_by_value('57598')

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to extract data from website?

How to extract the data from a website using java?

How to extract data from website with VBA Excel?

Extract a hyperlink from a website - Selenium

How to scrape data from a dynamic website with Selenium

How to scrape data from website using selenium

How to extract the product titles from the website using Selenium Python

how can i extract this value from a website, with python, selenium and chromedriver

How to to extract data from notam using selenium

How to extract table data from a website only AFTER inputting data?

how to extract the data from from website and save the into txt file

Extract data from BSE website

How to extract data from a website with specifying a search criteria?

How to extract data from a website's search bar using python?

how to extract data from a website while navigating logically

How to extract tabular data from a website using R

How to extract data from a secure website like bloomberg

How do I extract data from df ~ onto my website?

How do i extract data from a live website with python?

Is there any other way to extract data from dynamic website, rather than using selenium?

How to extract numbers from the website

How to extract data from a dynamic table with selenium python?

How to extract data from product page with selenium python

How do i extract data from yelp using selenium python

How to extract the price for the security as text from the website through Python Selenium BeautifulSoup

How to extract ec2 instance details like name, memory from aws website using python selenium

How do I Extract ZIP code from a Website using selenium python

python scrapy extract data from website

Extract data for all the instances from a dynamic website