提问人:jeremoquai 提问时间:12/24/2019 最后编辑:undetected Seleniumjeremoquai 更新时间:12/25/2019 访问量:7758
网站阻止 Selenium :有没有办法绕过?
Website blocking Selenium : is there a way to bypass?
问:
此网页手动打开正常,但在使用 Selenium 时直接进入“维护”错误消息!
from selenium import webdriver
driver = webdriver.Chrome(executable_path="chromedriver")
driver.get("https://www.winamax.fr/paris-sportifs/")
有没有办法避免这种行为?
答:
0赞
JaFizz
12/24/2019
#1
有时网站会检查您的.也许你可以改变这一点。user-agent
否则,我建议使用 Auto-It 来完成这项工作。
您也可以尝试将您的个人 Chrome 个人资料加载到 Selenium 中。
评论
0赞
jeremoquai
12/24/2019
我尝试更改了几页中提到的 chromedriver,但它没有改变任何事情
0赞
jeremoquai
12/24/2019
还换了用户代理,没有运气
0赞
jeremoquai
12/24/2019
我花了 3 周时间用 python/selenium 编写脚本,找到正确的 XPath 等。 不幸的是,我非常确定我不能用 Auto-IT 做得那么好
0赞
Seema Nair
1/14/2020
您能否分享使用的 chromedriver 版本和 chrome 浏览器的版本?
0赞
Priya
3/23/2021
@jeremoquai我遇到了完全相同的问题:(经过我 3 个月的辛勤工作编写和编译剧本,这真是令人费解。你能找到任何可能的解决方案吗?我也在stackoverflow上发帖,但直到现在还没有运气
0赞
undetected Selenium
12/25/2019
#2
有点不清楚为什么你觉得网站阻止了Selenium。但是,我能够按照以下解决方案访问该网站:
代码块:
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC options = webdriver.ChromeOptions() options.add_argument("start-maximized") options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False) driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe') driver.get('https://www.winamax.fr/paris-sportifs/') WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "section#above-content a[href='/paris-sportifs']"))) print(driver.page_source)
控制台输出:
<html class="app-desktop js flexbox canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths pointerevents cssremunit" lang="fr" style=""><!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--><!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--><!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--><!--[if gt IE 8]><!--><!--<![endif]--><head> <title>Paris Sportifs - Parier en ligne avec Winamax</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=1024"> <meta name="verify-v1" content="divGwlYLgkmoS558zISY8BYg1KLLvQLFmRf0CmPJ1kc="> <meta name="google-site-verification" content="DB-aVdWJ00FHClrX_fsXFGgZzaYUKGVcvY7uSfOkXsw"> <meta name="format-detection" content="telephone=no"> <meta name="apple-mobile-web-app-title" content="Winamax"> <meta property="og:description" content="Agréé par l’Arjel – Pariez sur le sport sur Winamax! Faites un premier dépôt et votre premier pari sera remboursé si il est perdant."> <meta property="og:image" content="https://operator-front-static-cdn.winamax.fr/img/content/betting/ParisSportif_Facebook.jpg?v=20150401"> <meta property="fb:admins" content="519584907"> <meta property="og:site_name" content="Winamax.fr"> <meta property="og:type" content="game"> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:site" content="@WinamaxSport"> <meta name="twitter:title" content="Paris Sportifs - Parier en ligne avec Winamax"> <meta name="twitter:description" content="Agréé par l’Arjel – Pariez sur le sport sur Winamax! Faites un premier dépôt et votre premier pari sera remboursé si il est perdant."> <meta name="twitter:image:src" content="https://operator-front-static-cdn.winamax.fr/img/content/betting/ParisSportif_Facebook_twitter.jpg?v=20150401"> <meta name="twitter:domain" content="winamax.fr"> <meta property="og:url" content="https://www.winamax.fr/paris-sportifs/"> <link rel="stylesheet" id="normalize" href="https://operator-front-static-cdn.winamax.fr/style/v2/normalize.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="reset" href="https://operator-front-static-cdn.winamax.fr/style/v2/reset.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="fontawesome" href="https://operator-front-static-cdn.winamax.fr/style/v2/fontawesome.min.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="magnific-popup" href="https://operator-front-static-cdn.winamax.fr/style/v2/magnific-popup.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="spritesheet" href="https://operator-front-static-cdn.winamax.fr/style/v2/spritesheet.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="common" href="https://operator-front-static-cdn.winamax.fr/style/v2/common.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="fancybox" href="https://operator-front-static-cdn.winamax.fr/style/v2/jquery.fancybox.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="doubleslider" href="https://operator-front-static-cdn.winamax.fr/style/v2/doubleslider.css?v=20191219-1" type="text/css" media="all"> <link rel="stylesheet" id="source-sans-pro" href="https://operator-front-static-cdn.winamax.fr/style/fonts/SourceSansPro/source-sans-pro.css?v=20191219-1" type="text/css" media="all"> <link rel="icon" href="https://operator-front-static-cdn.winamax.fr/img/style/v2/favicon.ico" type="image/png"> <link rel="manifest" href="/manifest.json"> <link rel="apple-touch-icon" href="https://operator-front-static-cdn.winamax.fr/img/style/v2/20170721_touch_icon_winamax.png"> <link rel="canonical" href="https://www.winamax.fr/paris-sportifs/"> <link rel="alternate" hreflang="fr" href="https://www.winamax.fr/paris-sportifs/"> <link rel="alternate" hreflang="en" href="https://www.winamax.fr/en/sports-betting/"> <link rel="alternate" hreflang="de" href="https://www.winamax.fr/de/sportwetten/"> <script async="" src="https://www.google-analytics.com/analytics.js"></script><script type="text/javascript" async="" src="https://ssl.google-analytics.com/ga.js"></script><script type="text/javascript" src="https://operator-front-static-cdn.winamax.fr/script/swfobject.js?v=20191219-1"></script> <script type="text/javascript" src="https://operator-front-static-cdn.winamax.fr/script/v2/betting-helpers.js?v=20191219-1"></script> <script type="text/javascript" src="https://operator-front-static-cdn.winamax.fr/script/numeral.js?v=20191219-1"></script> <script type="text/javascript" src="https://operator-front-static-cdn.winamax.fr/script/numeral.languages.js?v=20191219-1"></script> <script src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/modernizr.custom.js?v=20191219-1"></script> <!--[if lte IE 8]> <script src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/jquery-1.10.1.min.js?v=20191219-1"></script> <script src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/selectivizr-min.js?v=20191219-1"></script> <![endif]--> <script language="Javascript" type="text/javascript" src="https://operator-front-static-cdn.winamax.fr/script/messages/messages_fr.js?v=20191219-1"></script> <script> var $siteLanguage = 'FR'; var $siteLanguagePath = ''; var $siteLicense = 'FR'; </script> <style data-styled-components=""></style><script charset="utf-8" src="https://operator-front-static-cdn.winamax.fr/betting/client/1.55.1/main.30da6bcf4d935f4ad03c.js"></script><script charset="utf-8" src="https://operator-front-static-cdn.winamax.fr/betting/client/1.55.1/main.6dcf45fd436abb91aedd.js"></script><script charset="utf-8" src="https://operator-front-static-cdn.winamax.fr/betting/client/1.55.1/main.1812cb976eb7abff1666.js"></script><script charset="utf-8" src="https://operator-front-static-cdn.winamax.fr/betting/client/1.55.1/main.fbe533b04c719597d791.js"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="jquery" src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/jquery-1.12.4.min.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="swipe" src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/swipe.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="touch" src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/jquery.touch.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="magnific" src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/jquery.magnific-popup.min.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="fancybox" src="https://operator-front-static-cdn.winamax.fr/script/v2/lib/jquery.fancybox.pack.js?v=20191219-1"></script><style id="detectElementResize" type="text/css">@keyframes resizeanim { from { opacity: 0; } to { opacity: 0; } } .resize-triggers { animation: 1ms resizeanim; visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }</style><style type="text/css">.fancybox-margin{margin-right:17px;}</style><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="script/v2/common" src="https://operator-front-static-cdn.winamax.fr/script/v2/common.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="script/v2/mobile" src="https://operator-front-static-cdn.winamax.fr/script/v2/mobile.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="script/v2/gallery" src="https://operator-front-static-cdn.winamax.fr/script/v2/gallery.js?v=20191219-1"></script><script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="script/v2/doubleslider" src="https://operator-front-static-cdn.winamax.fr/script/v2/doubleslider.js?v=20191219-1"></script></head> <body class="lang-fr license-fr"> <div id="wrap-menu-overlay"></div> <!-- Facebook --> <div id="fb-root"></div> <script>$fbLocalized = 'fr_FR';</script> <div id="doc"> <div id="inner-wrap"><div style="cursor: pointer; background: url("https://static.winamax.fr/img/style/v2/common/avertissement.png?v=2") center center no-repeat rgb(0, 0, 0); height: 60px; z-index: 112; display: block;"></div> <script> var arjelBannerImgPath = Math.random() > 0.5 ? "https://static.winamax.fr/img/style/v2/common/avertissement.png?v=2" : "https://static.winamax.fr/img/style/v2/common/avertissement-alt.png"; function setupArjelBanner() { var ref = document.getElementById("inner-wrap"); if (ref) { var banner = document.createElement("div"); banner.style.cursor = "pointer"; banner.style.background = "url('" + arjelBannerImgPath + "') no-repeat center center #000"; banner.style.height = "60px"; banner.style.zIndex = Math.floor(50 + Math.random() * 100); function goArjelInfos() { window.open("https://www.winamax.fr/CLIC/PREVENTION/JIS_HOME/www.joueurs-info-service.fr"); } function WidthChange(mq) { if (mq.matches) { var arjelBannerImgPath = Math.random() > 0.5 ? "https://static.winamax.fr/img/style/v2/common/avertissement-mobile.png?v=2" : "https://static.winamax.fr/img/style/v2/common/avertissement-alt-mobile.png"; banner.style.background = "url('" + arjelBannerImgPath + "') no-repeat center center #000"; banner.style.backgroundSize = "100% auto"; } else { banner.style.display = "block"; } } banner.addEventListener("click", goArjelInfos, false); ref.insertBefore(banner, ref.firstChild); if (matchMedia) { var mq = window.matchMedia("(max-width: 480px)"); mq.addListener(WidthChange); WidthChange(mq); } } } setupArjelBanner(); </script> <div class="top-notif-wrapper"><div class="notification top-notif medium cookie-consent"> <i class="icon-warning-sign"></i> <p><span>En poursuivant votre navigation sur ce site, vous acceptez l’utilisation de Cookies afin de réaliser des statistiques de visites et vous proposer des promotions adaptées. <a href="/a-propos_conditions-generales-d-utilisation_s-opposer-aux-cookies?cookie-consent=0">S’y opposer</a> - <a href="/a-propos_conditions-generales-d-utilisation_plus-d--information-sur-les-cookies?cookie-consent=0">Plus d’informations sur les cookies</a></span></p> <a href="#" onclick="$(this).parent().hide(); return false"><i class="icon-remove"></i></a></div> </div><header id="masthead"> <div class="container"> <a href="/" id="logo"> <img src="https://operator-front-static-cdn.winamax.fr/img/style/v2/common/logo.png" alt="Winamax"> <img class="hover" src="https://operator-front-static-cdn.winamax.fr/img/style/v2/common/logo-highlight.png" alt=""> </a> <div class="content"> <div id="login-toggle" class="toggle"> <a href="/account/login.php?redir=/paris-sportifs/"> <svg id="user-icon" viewBox="0 0 32 24"> <path d="M10.3,13.9c0,0-7.1-0.1-9.8,5.3v4.7h9.8h9.8v-4.7C17.5,13.8,10.3,13.9,10.3,13.9z"></path> <ellipse cx="10.3" cy="6.4" rx="4.9" ry="6.2"></ellipse> </svg> </a> </div> <div id="login-container" class="expandable"> <a href="/account/login.php?redir=/paris-sportifs/" id="login-link">Se connecter</a> <a href="/account/create.php" id="signup-button" class="button">S'inscrire</a> <div id="login-popup"> <form id="login-form" method="post" action="/paris-sportifs/" autocomplete="off"> <p class="field"> <label>Adresse email</label> <input type="email" name="email" id="loginbox_email" placeholder="[email protected]" tabindex="1" autocomplete="off" value=""> </p> <p class="field"> <label>Mot de passe</label> <input type="password" id="loginbox_password" name="password" placeholder="" tabindex="2" autocomplete="off"> <a class="forgot-password" href="/account/lost_password.php">Mot de passe oublié ?</a> </p> <p class="field birthdate"> <label for="day-input">Date de naissance</label> <input type="text" id="loginbox_birthday" name="birth_day" autocomplete="off" placeholder="JJ" tabindex="3" pattern="[0-9]*" size="2" maxlength="2" value=""> <input type="text" id="loginbox_birthmonth" name="birth_month" autocomplete="off" placeholder="MM" tabindex="4" pattern="[0-9]*" size="2" maxlength="2" value=""> <input type="text" id="loginbox_birthyear" name="birth_year" autocomplete="off" placeholder="AAAA" tabindex="5" pattern="[0-9]*" size="4" maxlength="4" value=""> </p> <button type="submit" id="login-button" name="submitlogin" class="secondary-button" tabindex="6"><i class="icon-lock"></i>Connexion</button> </form> <div id="no-account"> <a href="/account/create.php"><span>Pas encore de compte ?</span> Inscrivez-vous gratuitement</a> </div> </div> <div id="pin-popup"> </div> </div> <div id="search" class="expandable" style="height:28px"> </div> <div id="nav-toggle" class="toggle"> <svg id="list-icon" viewBox="0 0 24 24"> <rect x="6" y="17" width="18" height="3"></rect> <rect x="6" y="10.5" width="18" height="3"></rect> <rect x="6" y="4" width="18" height="3"></rect> <rect x="0" y="4" width="3" height="3"></rect> <rect x="0" y="10.5" width="3" height="3"></rect> <rect x="0" y="17" width="3" height="3"></rect> </svg> </div> </div> </div> <nav id="main-nav" class=""> <ul class="main-nav-list"> <li class=""> <a href="/jouer-au-poker">JOUER AU POKER</a> </li> <li class="focus"> <a href="/paris-sportifs">PARIS SPORTIFS</a> </li> <li class=""> <a href="/paris-sportifs-grilles">GRILLES</a> </li> <li class=""> <a href="/jde/contests">JEU DE L’ENTRAINEUR</a> </li> <li class=""> <a href="/paris-sportifs_promos_accueil">PROMOS</a> </li> <li class=""> <a href="/l-espace-vip_introduction">VIP</a> </li> <li class=""> <a href="/paris-sportifs_actus">ACTUS</a> </li> </ul> </nav> </header> <section id="above-content"> <nav id="secondary-nav" class="container"> <div id="section-title"> <a href="/paris-sportifs">Paris Sportifs</a> </div> <ul> <li><a href="/paris-sportifs" ng-class="menuClass('sport')" data-nav="home" class="betting-top-nav selected">À la Une</a></li> <li><a href="/paris-sportifs/live" ng-class="menuClass('live')" data-nav="live" class="betting-top-nav">LIVE</a></li> <li><a href="/paris-sportifs/multiplex" ng-class="menuClass('multiplex')" data-nav="multiplex" class="betting-top-nav">Multiplex</a></li> <li><a href="/paris-sportifs/winamax-tv" ng-class="menuClass('winamaxtv')" data-nav="winamax-tv" class="betting-top-nav">Winamax TV</a></li> <li><a href="/paris-sportifs/calendar" ng-class="menuClass('calendar')" data-nav="calendar" class="betting-top-nav">Calendrier</a></li> <li><a href="/paris-sportifs/history" ng-class="menuClass('history')" data-nav="history" class="betting-top-nav">Mes paris</a></li> <li><a href="/paris-sportifs-betradar-stats" class="">Stats</a></li> <li><a href="/paris-sportifs_scores-en-direct" class="">Résultats</a></li> </ul> </nav> </section>
评论
0赞
jeremoquai
12/25/2019
我复制/粘贴了您的代码,我仍然有“Winamax est actuellement en maintenance”!
评论