Home > Mobile >  no such element: Unable to locate element error - scraping with selenium
no such element: Unable to locate element error - scraping with selenium

Time:09-28

I can see this question was asked before and browsed through some of the answers with no luck. I am having trouble scraping data from sports betting site which I need for my analysis. I am getting: no such element: Unable to locate element error. Also, there is a chance betting sites may prohibit scraping data from their sites but I can't confirm it. Also, some suggestions from previously answered questions suggest some issues with iframe(which I am not too familiar with). Here is my code:

import requests
from bs4 import BeautifulSoup
import pandas as pd
from selenium import webdriver
#from selenium.webdriver.support.ui import WebDriverWait
#from selenium.webdriver.support import expected_conditions as EC
#from selenium.webdriver.common.by import By
#from selenium.common.exceptions import TimeoutException


driver = webdriver.Chrome('C:/Users/tmarkac/source/repos/chromedriver.exe')
driver.get('https://superbet.pl/zaklady-bukmacherskie/live')
name1 = driver.find_element("xpath",'//*[@id="event-4102570"]/div[1]/div[1]/div[1]/div[2]/div[1]/span[1]')
print(name1)

This is part of my page source(can get only 30k of characters in the post):

<html lang="en"  style="--vh:12.48px;"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover"><title>Zakłady live - obstawiaj zakłady na żywo w Superbet</title><style> .webpush-window-body { height: 100%; min-height: 100%; padding: 0; margin: 0;}#webpush-window { position: absolute; text-align: center; width: 100%; left: 0; top: 50%; opacity: 0;}#webpush-window-image { height: 128px; margin-bottom: 10px;}#webpush-window-title { font-size: 22px; padding: 0 5px;}#webpush-window-text { color: #333333; margin-top: 15px; padding: 0 5px; line-height: 22px;}#webpush-custom-prompt { position: fixed; z-index: 9999999; width: 320px; max-width: 100%; padding: 10px; top: 0; left: 50%; margin-left: -170px; background-color: rgb(231,232,233); box-shadow: 0px 0px 6px #888888; color: #000000; font-family: 'Trebuchet MS', Helvetica, sans-serif;}#webpush-custom-prompt-image { width: 64px; position: absolute; top: 15px; left: 15px;}#webpush-custom-prompt-title { margin-left: 90px; margin-top: 4px; font-size: 13px; font-weight: bold; line-height: 18px;}#webpush-custom-prompt-text { font-size: 10px; margin-left: 90px; margin-top: 5px; line-height: 15px;}#webpush-custom-prompt-buttons { padding-top: 10px; padding-right: 10px; padding-bottom: 10px; float: right;}#webpush-custom-prompt-button1 { background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ffffff), color-stop(1, #f6f6f6)); background:-moz-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); background:-webkit-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); background:-o-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); background:-ms-linear-gradient(top, #ffffff 5%, #f6f6f6 100%); background:linear-gradient(to bottom, #ffffff 5%, #f6f6f6 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#f6f6f6',GradientType=0); background-color:#ffffff; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; border:1px solid #dcdcdc; display:inline-block; color:#666666; font-size:12px; padding:4px 24px; margin-right: 6px; cursor: default;}#webpush-custom-prompt-button2 { background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #33bdef), color-stop(1, #019ad2)); background:-moz-linear-gradient(top, #33bdef 5%, #019ad2 100%); background:-webkit-linear-gradient(top, #33bdef 5%, #019ad2 100%); background:-o-linear-gradient(top, #33bdef 5%, #019ad2 100%); background:-ms-linear-gradient(top, #33bdef 5%, #019ad2 100%); background:linear-gradient(to bottom, #33bdef 5%, #019ad2 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#33bdef', endColorstr='#019ad2',GradientType=0); background-color:#33bdef; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; border:1px solid #057fd0; display:inline-block; color:#ffffff; font-size:12px; padding:4px 24px; cursor: default;}#webpush-notification-center-open.webpush-notification-center-position-left { left: 16px;}#webpush-notification-center-open.webpush-notification-center-position-right { right: 16px;}#webpush-notification-center { position: fixed; z-index: 9999999; font-family: 'Trebuchet MS', Helvetica, sans-serif; display: none; overflow-y: auto;}#webpush-notification-center.webpush-notification-center-layout-panel { top: 0; bottom: 0; width: 300px; max-width: 90%;}#webpush-notification-center.webpush-notification-center-layout-popup { top: 20px; height: 400px; width: 300px; max-width: 90%; margin-right: 20px; margin-left: 20px;}#webpush-notification-center.webpush-notification-center-position-left { left: 0;}#webpush-notification-center.webpush-notification-center-position-right { right: 0;}#webpush-notification-center.webpush-notification-center-color-light { background: #ffffff; box-shadow: 0px 0px 6px #888888; color: #666666;}#webpush-notification-center.webpush-notification-center-color-dark { background: #555555; box-shadow: 0px 0px 6px #888888; color: #ffffff;}#webpush-notification-center-header { height: 40px; border-bottom: 1px solid #d9d9d9; position: relative;}#webpush-notification-center-subscription { padding: 0 50px 0 8px;}#webpush-notification-center-subscription-switch-container { float: left; padding-top: 15px;}#webpush-notification-center-subscription-status { float: left; font-size: 12px; line-height: 40px; letter-spacing: 0.1em;}#webpush-notification-center-subscription .webpush-onoffswitch { display: inline-block; margin-right: 16px; margin-left: 8px;}#webpush-notification-center-icon { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; background-repeat: no-repeat; background-position: center center; background-size: 20px 20px;}#webpush-notification-center-title { font-size: 13px; line-height: 40px; letter-spacing: 0.1em; text-align: center;}#webpush-notification-center-close { position: absolute; top: 14px; right: 8px; height: 12px; width: 12px; font-size: 12px; background-repeat: no-repeat; background-position: center center; background-size: 12px 12px; cursor: pointer;}#webpush-notification-center-list { overflow-x: hidden; overflow-y: auto; position: absolute; top: 41px; left: 0; right: 0; bottom: 0;}.webpush-notification-center-item { padding: 8px 8px; position: relative; font-size: 12px; min-height: 48px; cursor: pointer;}.webpush-notification-center-color-light .webpush-notification-center-item { border-bottom: 1px solid #f3f3f3;}.webpush-notification-center-color-dark .webpush-notification-center-item { border-bottom: 1px solid #808080;}.webpush-notification-center-color-light .webpush-notification-center-item:hover { background-color: #f3f3f3;}.webpush-notification-center-color-dark .webpush-notification-center-item:hover { background-color: #808080;}.webpush-notification-center-item-image { width: 48px; height: 48px; float: left;}.webpush-notification-center-item-title { padding-left: 58px; font-weight: bold;}.webpush-notification-center-item-title p { margin: 0px;}.webpush-notification-center-item-text { padding-left: 58px; margin-top: 4px;}.webpush-notification-center-item-text p { margin: 0px;}.webpush-notification-center-item-date { padding-left: 58px; margin-top: 3px; font-size: 11px; color: #b7b7b7;}.webpush-notification-center-item-webinbox-card { padding: 0;}.webpush-notification-center-item-webinbox-card .webpush-notification-center-item-image { width: 100%; height: auto; float: none; margin: 0px; padding: 0px;}.webpush-notification-center-item-webinbox-card .webpush-notification-center-item-title { padding: 5px 7px; font-weight: bold;}.webpush-notification-center-item-webinbox-card .webpush-notification-center-item-text-container { padding: 0px 7px 5px 7px; margin: 0px;}.webpush-notification-center-item-webinbox-card .webpush-notification-center-item-text { padding: 5px 0px 0px 0px; margin-top: 0px;}.webpush-notification-center-item-webinbox-card .webpush-notification-center-item-date { display: none;}#webpush-notification-center-loader { text-align: center; padding: 8px; height: 15px;}#webpush-notification-center-title-loader { text-align: center; padding-top: 14px; height: 40px;}#webpush-notification-center-placeholder { font-size: 12px; line-height: 30px; padding: 5px 16px;}#webpush-notification-center-load-more { font-size: 12px; line-height: 30px; text-align: center; cursor: pointer;}.webpush-notification-center-color-light #webpush-notification-center-load-more { border-bottom: 1px solid #f3f3f3;}.webpush-notification-center-color-dark #webpush-notification-center-load-more { border-bottom: 1px solid #808080;}.webpush-notification-center-color-light #webpush-notification-center-load-more:hover { background-color: #f3f3f3;}.webpush-notification-center-color-dark #webpush-notification-center-load-more:hover { background-color: #808080;}#webpush-notification-center-open { position: fixed; z-index: 9999999; top: 20px; height: 60px; width: 60px; border-radius: 50%; cursor: pointer; text-align: center; line-height: 60px; background-size: 30px 30px; box-shadow: 0 4px 8px rgba(0,0,0,0.16), 0 2px 4px rgba(0,0,0,0.2); transition: 0.7s ease;}#webpush-notification-center-open:hover { box-shadow: 0 7px 14px rgba(0,0,0,0.16), 0 5px 10px rgba(0,0,0,0.2); transition: 0.7s ease; transform-origin: center;}#webpush-notification-center-open[badge-count]:after { position: absolute; right: -3px; top: -3px; content: attr(badge-count); font-size: 12px; padding: 5px; border-radius: 50%; line-height: 12px; color: #ffffff; background: #ed1c25; text-align: center; min-width: 12px; font-weight: bold;}#webpush-notification-center-open.webpush-notification-center-color-light { background-color: #1d87c8;}#webpush-notification-center-open.webpush-notification-center-color-light:hover { background-color: #2298e1;}#webpush-notification-center-open.webpush-notification-center-color-dark { background-color: #555555;}#webpush-notification-center-open.webpush-notification-center-color-dark:hover { background-color: #5a606e;}#webpush-notification-center-open.webpush-notification-center-color-custom { background-color: #1d87c8;}#webpush-notification-center-open.webpush-notification-center-color-custom:hover { background-color: #2298e1;}#webpush-local-notification-stack { position: fixed; top: 20px; right: 20px; z-index: 9999999; margin-left: 20px;}.webpush-local-notification { background: #ffffff; max-width: 370px; width: 100%; min-width: 250px; box-shadow: 0px 0px 6px #888888; position: relative; -webkit-transition: opacity 0.2s ease-in-out; -moz-transition: opacity 0.2s ease-in-out; -ms-transition: opacity 0.2s ease-in-out; -o-transition: opacity 0.2s ease-in-out; transition: opacity 0.2s ease-in-out; font-family: 'Trebuchet MS', Helvetica, sans-serif; color: #666666; margin-bottom: 10px; min-height: 80px; cursor: default;}.webpush-local-notification-close { position: absolute; top: 8px; right: 8px; cursor: pointer;}.webpush-local-notification-image { width: 80px; height: 80px; float: left;}.webpush-local-notification-title { padding-left: 95px; padding-top: 10px; padding-right: 35px; font-size: 14px; line-height: 20px; color: #444444;}.webpush-local-notification-text { padding-left: 95px; padding-top: 8px; padding-right: 10px; padding-bottom: 10px; font-size: 13px; line-height: 18px;}.webpush-onoffswitch-container { line-height: 10px;}.webpush-onoffswitch { position: relative; width: 30px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none;}.webpush-onoffswitch-checkbox { display: none;}.webpush-onoffswitch-label { display: block; overflow: hidden; cursor: pointer; height: 10px; padding: 0; line-height: 10px; border-radius: 16px; background-color: rgba(158,158,158,0.5);}.webpush-onoffswitch-label:before { content: ''; display: block; width: 16px; margin: -3px; background-color: rgb(158,158,158); position: absolute; top: 0; bottom: 0; right: 18px; border-radius: 16px;}.webpush-onoffswitch-checkbox:checked   .webpush-onoffswitch-label { background-color: rgba(47,169,214,0.5);}.webpush-onoffswitch-checkbox:checked   .webpush-onoffswitch-label .webpush-onoffswitch-inner { margin-left: 0;}.webpush-onoffswitch-checkbox:checked   .webpush-onoffswitch-label:before { right: 0; background-color: rgb(47,169,214); box-shadow: none;}.webpush-onoffswitch-tooltip { display: none; position: absolute; min-width: 50px; max-width: 200px; min-height: 16px; max-height: 200px; background: rgba(0, 0, 0, .8); color: #fff; padding: 8px; border-radius: 2px; z-index: 3000; line-height: 16px; font-size: 12px; opacity: 0.9; -webkit-transition: opacity 75ms linear; -moz-transition: opacity 75ms linear; -ms-transition: opacity 75ms linear; transition: opacity 75ms linear; top: 32px; left: 15px;}.webpush-reset { animation: none; animation-delay: 0s; animation-direction: normal; animation-duration: 0s; animation-fill-mode: none; animation-iteration-count: 1; animation-name: none; animation-play-state: running; animation-timing-function: ease; backface-visibility: visible; background: 0; background-attachment: scroll; background-clip: border-box; background-color: transparent; background-image: none; background-origin: padding-box; background-position: 0 0; background-position-x: 0; background-position-y: 0; background-repeat: repeat; background-size: auto auto; border: 0; border-style: none; border-width: medium; border-color: inherit; border-bottom: 0; border-bottom-color: inherit; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-style: none; border-bottom-width: medium; border-collapse: separate; border-image: none; border-left: 0; border-left-color: inherit; border-left-style: none; border-left-width: medium; border-radius: 0; border-right: 0; border-right-color: inherit; border-right-style: none; border-right-width: medium; border-spacing: 0; border-top: 0; border-top-color: inherit; border-top-left-radius: 0; border-top-right-radius: 0; border-top-style: none; border-top-width: medium; bottom: auto; box-shadow: none; box-sizing: content-box; caption-side: top; clear: none; clip: auto; color: inherit; columns: auto; column-count: auto; column-fill: balance; column-gap: normal; column-rule: medium none currentColor; column-rule-color: currentColor; column-rule-style: none; column-rule-width: 0; column-span: 1; column-width: auto; content: normal; counter-increment: none; counter-reset: none; cursor: auto; direction: ltr; display: inline; empty-cells: show; float: none; /*font: normal;*/ font-family: inherit; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; height: auto; hyphens: none; left: auto; letter-spacing: normal; line-height: normal; list-style: none; list-style-image: none; list-style-position: outside; list-style-type: disc; margin: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; margin-top: 0; max-height: none; max-width: none; min-height: 0; min-width: 0; opacity: 1; orphans: 0; outline: 0; outline-color: invert; outline-style: none; outline-width: medium; overflow: visible; overflow-x: visible; overflow-y: visible; padding: 0; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; page-break-after: auto; page-break-before: auto; page-break-inside: auto; perspective: none; perspective-origin: 50% 50%; position: static; right: auto; tab-size: 8; table-layout: auto; text-align: inherit; text-align-last: auto; text-decoration: none; text-decoration-line: none; text-decoration-style: solid; text-indent: 0; text-shadow: none; text-transform: none; top: auto; transform: none; transform-style: flat; transition: none; transition-delay: 0s; transition-duration: 0s; transition-property: none; transition-timing-function: ease; unicode-bidi: normal; vertical-align: baseline; visibility: visible; white-space: normal; widows: 0; width: auto; word-spacing: normal; z-index: auto;}.webpush-loader { display: inline-block; position: relative; vertical-align: middle; width: 48px; height: 16px;}.webpush-loader div { position: absolute; top: 3px; left: 21px; width: 4px; height: 4px; background-color: #666666; -webkit-border-radius: 2px; border-radius: 2px; background-clip: padding-box; -webkit-animation: growDot 1s linear .15s infinite; -moz-animation: growDot 1s linear .15s infinite; -ms-animation: growDot 1s linear .15s infinite; -o-animation: growDot 1s linear .15s infinite; animation: growDot 1s linear .15s infinite;}.webpush-loader div:before { content: ''; position: absolute; top: 0; left: -15px; width: 4px; height: 4px; background-color: #666666; -webkit-border-radius: 2px; border-radius: 2px; background-clip: padding-box; -webkit-animation: growDot 1s linear 0s infinite; -moz-animation: growDot 1s linear 0s infinite; -ms-animation: growDot 1s linear 0s infinite; -o-animation: growDot 1s linear 0s infinite; animation: growDot 1s linear 0s infinite;}.webpush-loader div:after { content: ''; position: absolute; top: 0; left: 15px; width: 4px; height: 4px; background-color: #666666; -webkit-border-radius: 2px; border-radius: 2px; background-clip: padding-box; -webkit-animation: growDot 1s linear .3s infinite; -moz-animation: growDot 1s linear .3s infinite; -ms-animation: growDot 1s linear .3s infinite; -o-animation: growDot 1s linear .3s infinite; animation: growDot 1s linear .3s infinite;}@-webkit-keyframes growDot { 0% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)';  filter: alpha(opacity=70);  opacity: 0.7;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; } 25% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';  filter: alpha(opacity=100);  opacity: 1;  -webkit-box-shadow: 0px 0px 0px 2px #666666;  box-shadow: 0px 0px 0px 2px #666666; } 50% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)';  filter: alpha(opacity=70);  opacity: 0.7;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; } 100% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=60)';  filter: alpha(opacity=60);  opacity: 0.6;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; }}@keyframes growDot { 0% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)';  filter: alpha(opacity=70);  opacity: 0.7;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; } 25% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';  filter: alpha(opacity=100);  opacity: 1;  -webkit-box-shadow: 0px 0px 0px 2px #666666;  box-shadow: 0px 0px 0px 2px #666666; } 50% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)';  filter: alpha(opacity=70);  opacity: 0.7;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; } 100% {  -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=60)';  filter: alpha(opacity=60);  opacity: 0.6;  -webkit-box-shadow: 0px 0px 0px 0px #666666;  box-shadow: 0px 0px 0px 0px #666666; }}.webpush-balloon { background-repeat: no-repeat; background-position: center center; background-size: 100% 100%;}.webpush-balloon-light, .webpush-balloon-dark, .webpush-balloon-custom { background-image: url('data:image/svg xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8 CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI Cjxzdmcgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDE1MCAxNTAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjQxNDIxOyI CiAgICA8ZyBpZD0iWE1MSURfNDZfIiB0cmFuc2Zvcm09Im1hdHJpeCgxLjEyOTEyLDAsMCwxLjEyOTEyLDQ3OS43ODgsLTI0Mi4yODIpIj4KICAgICAgICA8cGF0aCBkPSJNLTM1OCwzNDFDLTM1MSwzNDEgLTM0Ni4yLDMzNSAtMzQ2LjIsMzI4TC0zNzAuMywzMjhDLTM3MC4zLDMzNSAtMzY0LDM0MSAtMzU4LDM0MVoiIHN0eWxlPSJmaWxsOndoaXRlO2ZpbGwtcnVsZTpub256ZXJvOyIvPgogICAgPC9nPgogICAgPGcgaWQ9IlhNTElEXzQ3XyIgdHJhbnNmb3JtPSJtYXRyaXgoMS4xMjkxMiwwLDAsMS4xMjkxMiw0NzkuNzg4LC0yNDIuMjgyKSI CiAgICAgICAgPHBhdGggZD0iTS0zMTguOSwzMDUuOEMtMzE4LjYsMzA1LjggLTMxOCwzMDUuNiAtMzE4LDMwNS4zTC0zMTgsMjczLjhDLTMxOCwyNTQuNyAtMzMyLDIzOC43IC0zNDksMjM0LjdMLTM0OSwyMjkuOEMtMzQ5LDIyNSAtMzUzLjEsMjIxIC0zNTgsMjIxQy0zNjIuOSwyMjEgLTM2NywyMjUgLTM2NywyMjkuOEwtMzY3LDIzNC42Qy0zODUsMjM4LjYgLTM5OCwyNTQuNiAtMzk4LDI3My43TC0zOTgsMzA1LjJDLTM5OCwzMDUuNSAtMzk3LjksMzA1LjcgLTM5Ny42LDMwNS43TC00MTAsMzE3TC00MTAsMzI0TC0zMDcsMzI0TC0zMDcsMzE3TC0zMTguOSwzMDUuOFoiIHN0eWxlPSJmaWxsOndoaXRlO2ZpbGwtcnVsZTpub256ZXJvOyIvPgogICAgPC9nPgo8L3N2Zz4K');}.webpush-clearfix { clear: both;}.webpush-swal2-title p { margin: 0;} </style><style>.webpush-notification-center-icon-bell {background-image:url("data:image/svg xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 459.334 459.334' style='enable-background:new 0 0 459.334 459.334;' xml:space='preserve' width='512px' height='512px'> <g> <g> <g> <path d='M175.216,404.514c-0.001,0.12-0.009,0.239-0.009,0.359c0,30.078,24.383,54.461,54.461,54.461 s54.461-24.383,54.461-54.461c0-0.12-0.008-0.239-0.009-0.359H175.216z' fill='#999999'/> <path d='M403.549,336.438l-49.015-72.002c0-22.041,0-75.898,0-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485 C254.152,10.963,243.19,0,229.667,0s-24.485,10.963-24.485,24.485v27.663c-57.237,11.381-100.381,61.879-100.381,122.459 c0,23.716,0,76.084,0,89.83l-49.015,72.002c-5.163,7.584-5.709,17.401-1.419,25.511c4.29,8.11,12.712,13.182,21.887,13.182 H383.08c9.175,0,17.597-5.073,21.887-13.182C409.258,353.839,408.711,344.022,403.549,336.438z' fill='#999999'/> </g> </g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </svg>");}.webpush-notification-center-icon-close {background-image:url("data:image/svg xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Capa_1' x='0px' y='0px' width='512px' height='512px' viewBox='0 0 357 357' style='enable-background:new 0 0 357 357;' xml:space='preserve'> <g> <g id='close'> <polygon points='357,35.7 321.3,0 178.5,142.8 35.7,0 0,35.7 142.8,178.5 0,321.3 35.7,357 178.5,214.2 321.3,357 357,321.3 214.2,178.5' fill='#999999'/> </g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </svg>");}</style><script type="text/javascript" async="" src="https://www.googletagmanager.com/gtag/js?id=G-5K6NJGJ1F8&amp;l=dataLayer&amp;cx=c"></script><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script type="text/javascript" async="" src="https://static.hotjar.com/c/hotjar-1693628.js?sv=7"></script><script gtm="GTM-PSKZC66" type="text/javascript" async="" src="https://www.googleoptimize.com/optimize.js?id=OPT-MJR4LQS"></script><script async="" src="https://prod.webpu.sh/ic6rRg2T8JGsA5AufXy2EVCbodNL0r7U/sdk.js"></script><script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-PSKZC66&amp;gtm_auth=nm0VsPiCyoBS0Xsaz2QatQ&amp;gtm_preview=env-1&amp;gtm_cookies_win=x"></script><script src="https://scorealarm-stats.freetls.fastly.net/localization/superbet/web/pl_translations.js"></script><script>window.translationMessages = translations;
        translations = null;</script><script src="/static/js/gtm.js"></script><script src="/static/js/one-trust.js"></script><script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" data-language="pl" data-domain-script="abb3dd46-d9ca-4d6c-b553-9aec751bf4ae"></script><script src="https://old.superbet.pl/rest/SBWeb.Models.Session/returnSiteParams.js"></script><link rel="shortcut icon" type="image/png" href="/static/img/icons/favicon.ico"><link rel="icon" type="image/png" sizes="16x16" href="/static/img/icons/favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="/static/img/icons/favicon-32x32.png"><link rel="manifest" href="/static/manifest.json" crossorigin="use-credentials"><meta name="google-site-verification" content="cAHJ7okzAxP1Bz422yebec0zmUMnZYD5NkqszVG3Ris"><!--[if IE]><link rel="shortcut icon" href="/static/img/icons/favicon.ico"><![endif]--><meta name="theme-color" content="#EA060A"><meta name="msapplication-TileColor" content="#fd0104"><meta name="msapplication-navbutton-color" content="##fd0104"><link rel="mask-icon" href="/static/img/safari-pinned-tab.svg" color="#fd0104"><link rel="apple-touch-icon" sizes="180x180" href="/static/img/apple-touch-icon.png"><meta name="apple-mobile-web-app-status-bar-style" content="#EA060A"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="apple-mobile-web-app-title" content="superbet.country"><meta name="msapplication-TileColor" content="#000000"><script src="https://cdn.seondf.com/js/v4/agent.js"></script><script src="/static/js/xtremePush.js"></script><script defer="defer" src="/static/js/chunk-vendors.21ae673b.js"></script><script defer="defer" src="/static/js/app.904e7ee0.js"></script><link rel="stylesheet" type="text/css" href="/static/css/4851.657224c0.css"><script src="https://cdn.cookielaw.org/scripttemplates/6.30.0/otBannerSdk.js" async="" type="text/javascript"></script><style id="onetrust-style">#onetrust-banner-sdk{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}#onetrust-banner-sdk .onetrust-vendors-list-handler{cursor:pointer;color:#1f96db;font-size:inherit;font-weight:bold;text-decoration:none;margin-left:5px}#onetrust-banner-sdk .onetrust-vendors-list-handler:hover{color:#1f96db}#onetrust-banner-sdk:focus{outline:2px solid #000;outline-offset:-2px}#onetrust-banner-sdk a:focus{outline:2px solid #000}#onetrust-banner-sdk #onetrust-accept-btn-handler,#onetrust-banner-sdk #onetrust-reject-all-handler,#onetrust-banner-sdk #onetrust-pc-btn-handler{outline-offset:1px}#onetrust-banner-sdk .ot-close-icon,#onetrust-pc-sdk .ot-close-icon,#ot-sync-ntfy .ot-close-icon{background-image:url("data:image/svg xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB3aWR0aD0iMzQ4LjMzM3B4IiBoZWlnaHQ9IjM0OC4zMzNweCIgdmlld0JveD0iMCAwIDM0OC4zMzMgMzQ4LjMzNCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMzQ4LjMzMyAzNDguMzM0OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI PGc PHBhdGggZmlsbD0iIzU2NTY1NiIgZD0iTTMzNi41NTksNjguNjExTDIzMS4wMTYsMTc0LjE2NWwxMDUuNTQzLDEwNS41NDljMTUuNjk5LDE1LjcwNSwxNS42OTksNDEuMTQ1LDAsNTYuODVjLTcuODQ0LDcuODQ0LTE4LjEyOCwxMS43NjktMjguNDA3LDExLjc2OWMtMTAuMjk2LDAtMjAuNTgxLTMuOTE5LTI4LjQxOS0xMS43NjlMMTc0LjE2NywyMzEuMDAzTDY4LjYwOSwzMzYuNTYzYy03Ljg0Myw3Ljg0NC0xOC4xMjgsMTEuNzY5LTI4LjQxNiwxMS43NjljLTEwLjI4NSwwLTIwLjU2My0zLjkxOS0yOC40MTMtMTEuNzY5Yy0xNS42OTktMTUuNjk4LTE1LjY5OS00MS4xMzksMC01Ni44NWwxMDUuNTQtMTA1LjU0OUwxMS43NzQsNjguNjExYy0xNS42OTktMTUuNjk5LTE1LjY5OS00MS4xNDUsMC01Ni44NDRjMTUuNjk2LTE1LjY4Nyw0MS4xMjctMTUuNjg3LDU2LjgyOSwwbDEwNS41NjMsMTA1LjU1NEwyNzkuNzIxLDExLjc2N2MxNS43MDUtMTUuNjg3LDQxLjEzOS0xNS42ODcsNTYuODMyLDBDMzUyLjI1OCwyNy40NjYsMzUyLjI1OCw1Mi45MTIsMzM2LjU1OSw2OC42MTF6Ii8 PC9nPjwvc3ZnPg==");background-size:contain;background-repeat:no-repeat;background-position:center;height:12px;width:12px}#onetrust-banner-sdk .powered-by-logo,#onetrust-banner-sdk .ot-pc-footer-logo a,#onetrust-pc-sdk .powered-by-logo,#onetrust-pc-sdk .ot-pc-footer-logo a,#ot-sync-ntfy .powered-by-logo,#ot-sync-ntfy .ot-pc-footer-logo a{background-size:contain;background-repeat:no-repeat;background-position:center;height:25px;width:152px;display:block}#onetrust-banner-sdk h3 *,#onetrust-banner-sdk h4 *,#onetrust-banner-sdk h6 *,#onetrust-banner-sdk button *,#onetrust-banner-sdk a[data-parent-id] *,#onetrust-pc-sdk h3 *,#onetrust-pc-sdk h4 *,#onetrust-pc-sdk h6 *,#onetrust-pc-sdk button *,#onetrust-pc-sdk a[data-parent-id] *,#ot-sync-ntfy h3 *,#ot-sync-ntfy h4 *,#ot-sync-ntfy h6 *,#ot-sync-ntfy button *,#ot-sync-ntfy a[data-parent-id] *{font-size:inherit;font-weight:inherit;color:inherit}#onetrust-banner-sdk .ot-hide,#onetrust-pc-sdk .ot-hide,#ot-sync-ntfy .ot-hide{display:none !important}#onetrust-pc-sdk .ot-sdk-row .ot-sdk-column{padding:0}#onetrust-pc-sdk .ot-sdk-container{padding-right:0}#onetrust-pc-sdk .ot-sdk-row{flex-direction:initial;width:100%}#onetrust-pc-sdk [type="checkbox"]:checked,#onetrust-pc-sdk [type="checkbox"]:not(:checked){pointer-events:initial}#onetrust-pc-sdk [type="checkbox"]:disabled label::before,#onetrust-pc-sdk [type="checkbox"]:disabled label:after,#onetrust-pc-sdk [type="checkbox"]:disabled label{pointer-events:none;opacity:0.7}#onetrust-pc-sdk #vendor-list-content{transform:translate3d(0, 0, 0)}#onetrust-pc-sdk li input[type="checkbox"]{z-index:1}#onetrust-pc-sdk li .ot-checkbox label{z-index:2}#onetrust-pc-sdk li .ot-checkbox input[type="checkbox"]{height:auto;width:auto}#onetrust-pc-sdk li .host-title a,#onetrust-pc-sdk li .ot-host-name a,#onetrust-pc-sdk li .accordion-text,#onetrust-pc-sdk li .ot-acc-txt{z-index:2;position:relative}#onetrust-pc-sdk input{margin:3px 

Can anyone tell me why I am getting this error? If I could get just one element from this page I believe I could get everything I need.

CodePudding user response:

Try waiting a bit to let the page render prior to running the find_element method. I use time.sleep in the example below for the sake of simplicity, but there are more practical and elegant solutions using the selenium waits API

import requests
from bs4 import BeautifulSoup
import pandas as pd
from selenium import webdriver
import time

driver = webdriver.Chrome('C:/Users/tmarkac/source/repos/chromedriver.exe')
driver.get('https://superbet.pl/zaklady-bukmacherskie/live')
time.sleep(2)  # pause code to let page render.
name1 = driver.find_element("xpath",'//*[@id="event-4102570"]/div[1]/div[1]/div[1]/div[2]/div[1]/span[1]')
print(name1)
  • Related