selenium 没有加载页面

from selenium import webdriver

driver= webdriver.Chrome()

driver.get('https://www.realestate.com.au/sold/') #opens normally but anything I search for doesn't load

driver.get('https://www.realestate.com.au/sold/in-alice+springs+-+greater+region%2c+nt%3b/list-1')

网站打开,我没有收到任何验证码或阻止,但页面未加载


慕码人2483693
浏览 209回答 3
3回答

泛舟湖上清波郎朗

我猜他们阻止了 selenium 的使用,看到相关请求返回 429。也许你可以有办法避免这种情况。

慕田峪9158850

这似乎是一些“Flash”问题(您可以在“chromedriver”窗口中阅读错误:Browser not compatible with given flash manifest本网站使用 flash,您的浏览器需要安装 flash player。我说你的浏览器是指 selenium 浏览器,而不是你手动打开的 chrome。要在 selenium chrome 浏览器中安装“flash player”,请运行您的脚本;它将打开浏览器,然后转到https://get.adobe.com/flashplayer/并安装 Flash Player。这应该可以解决问题

qq_笑_17

关于您的用例的更多信息将帮助我们以更好的方式调试问题。但是使用Selenium我能够访问该网站并检索页面源,如下所示:代码块:from selenium import webdriveroptions = webdriver.ChromeOptions()&nbsp;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.realestate.com.au/sold/")print(driver.page_source)控制台输出:<html class="js rui-burger rui-fancy-selects-on is-desktop app-loaded"><head>&nbsp; &nbsp; <meta http-equiv="x-ua-compatible" content="IE=edge">&nbsp; &nbsp; <meta charset="utf-8">&nbsp; &nbsp; <meta name="viewport" content="width=1140">&nbsp; &nbsp; <meta name="description" content="Discover how much the latest properties have been sold for. Browse sold real estate listings to find auction results and sold prices from all over Australia.">&nbsp; &nbsp; .&nbsp; &nbsp; .&nbsp; &nbsp; .<script type="text/javascript" async="" charset="utf-8" id="utag_rea-group.sp-only_27" src="//tags.tiqcdn.com/utag/rea-group/sp-only/prod/utag.27.js?utv=ut4.44.201710110106"></script><script type="text/javascript" async="" charset="utf-8" id="utag_rea-group.sp-only_64" src="//tags.tiqcdn.com/utag/rea-group/sp-only/prod/utag.64.js?utv=ut4.44.202005070432"></script><script type="text/javascript" src="https://odb.outbrain.com/utils/get?url=http%3A%2F%2Fwww.realestate.com.au%2Fsold&amp;settings=true&amp;recs=true&amp;widgetJSId=HPR&amp;key=NANOWDGT01&amp;idx=0&amp;version=20009&amp;apv=false&amp;sig=kLvLc8wa&amp;format=html&amp;va=true&amp;et=true&amp;rand=98241&amp;pdobuid=-1&amp;osLang=en-US&amp;winW=1366&amp;winH=657&amp;scrW=1366&amp;scrH=768&amp;adblck=false&amp;secured=true&amp;cmpStat=0&amp;ccpaStat=0&amp;ref=&amp;px=119&amp;py=1959&amp;vpd=1302" charset="UTF-8" async=""></script><script src="https://safeinator.reamedia.com.au/2073b42b71554175cf729737a838c1f1c6d7f862/lib/base.min.js" async="" type="text/javascript"></script></head>&nbsp; <!--[if IE 8]>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<body class="sold rui-preload ie ie8 lt-ie9 lt-ie10" data-rui-select-auto-init="false"> <![endif]-->&nbsp; <!--[if IE 9]>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<body class="sold rui-preload ie ie9 lt-ie10" data-rui-select-auto-init="false"> <![endif]-->&nbsp; <!--[if gt IE 9]><!-->&nbsp; <body class="sold" data-rui-select-auto-init="false"><iframe src="https://secure-au.imrworldwide.com/storageframe.html" id="LOCSTORAGE" scrolling="no" name="empty" hidden="true" style="width: 1px; height: 1px; position: absolute; top: -7px; left: -7px; border: 0px;"></iframe>&nbsp; &nbsp; <!--<![endif]-->&nbsp; &nbsp; <div class="hero">&nbsp; &nbsp; &nbsp; <ul class="rui-visuallyhidden rui-accessibility">&nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; <a href="#rui-main-nav" title="Go directly to the website navigation">skip to Main Navigation</a>&nbsp; &nbsp; </li>&nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; <a href="#rui-main-content" title="Go directly to main content">skip to Content</a>&nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; &nbsp; <header class="rui-header rui-header-inverse rui-header-not-fixed rui-clearfix" data-auto-init="false">&nbsp; &nbsp; <div class="rui-grid rui-header-container">&nbsp; &nbsp; &nbsp; <div class="rui-clearboth"></div>&nbsp; &nbsp; &nbsp; <button class="rui-burger-toggle rui-icon rui-icon-navdeck rui-button-no-style rui-desktop">&nbsp; &nbsp; &nbsp; &nbsp; <span class="rui-visuallyhidden">Menu</span>&nbsp; &nbsp; &nbsp; &nbsp; <span class="hit-box"></span>&nbsp; &nbsp; &nbsp; </button>&nbsp; &nbsp; &nbsp; <nav class="rui-myrea-nav">&nbsp; &nbsp; &nbsp; &nbsp; <div id="webCollectionsSlot"></div>&nbsp; &nbsp; &nbsp; &nbsp; <div id="webInboxSlot"></div>&nbsp; &nbsp; &nbsp; &nbsp; <div id="webInboxOverlay"></div>&nbsp; &nbsp; &nbsp; &nbsp; <ul class="rui-user-menu logged-out" style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; <a href="/my-real-estate/login" title="Sign in">Sign in</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; <a href="/my-real-estate/register" class="rui-button-brand join" title="Create an account">Join</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; &nbsp; &nbsp; <ul class="rui-user-menu logged-in rui-toggle-wrapper" style="display:none;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; <a href="#" class="rui-person-guy rui-toggle-link rui-icon rui-icon-user-off"></a>&nbsp; &nbsp; &nbsp; &nbsp; <div class="rui-account-menu-container">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <ul class="rui-account-menu rui-toggle-container">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li class="first">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/saved-properties" title="View saved properties">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="rui-icon rui-icon-save"></span><span>Saved properties</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/property/my-property" title="Track your property">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="rui-icon rui-icon-home"></span><span>Track your property</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="https://homeloans.realestate.com.au/my-finances" title="My finances">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="rui-icon rui-icon-commission"></span><span>My finances</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="/my-real-estate/saved-searches-and-email-alerts" title="View property alerts">Saved searches &amp; alerts</a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="/my-real-estate/profile" title="View profile">My profile</a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li><a href="/my-real-estate/account" title="Manage account settings">Account settings</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li class="last"><a href="/logout.ds" title="Log out">Log out</a></li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; &nbsp; </nav>&nbsp; &nbsp; </div>&nbsp; &nbsp; <div class="rui-grid rui-nav-container rui-burger-container">&nbsp; &nbsp; &nbsp; <a title="realestate.com.au homepage" href="/buy" class="logo">&nbsp; &nbsp; &nbsp; &nbsp; <img src="//s1.rui.au.reastatic.net/rui-static/img/rea-logo-thin-white-v3.png" alt="realestate.com.au Australia lives here">&nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; <nav class="rui-main-nav">&nbsp; &nbsp; &nbsp; &nbsp; <ul>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li class="rui-nav-tab buy">&nbsp; &nbsp; &nbsp; &nbsp; <a href="/buy" title="Real estate and property for sale">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>Buy</span>&nbsp; &nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <li class="rui-nav-tab commercial">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.realcommercial.com.au" target="_blank" title="Commercial real estate for sale and lease">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span>Commercial</span>&nbsp; &nbsp; &nbsp; &nbsp; </a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </li>&nbsp; &nbsp; &nbsp; &nbsp; </ul>&nbsp; &nbsp; &nbsp; </nav>&nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; </header>&nbsp; &nbsp; &nbsp; <div class="hero-content">&nbsp; &nbsp; <div class="search-form-container">&nbsp; &nbsp; &nbsp; <form action="listsearchview.ds" class="search-form" name="search-form">&nbsp; &nbsp; &nbsp; &nbsp; <h1 id="search-form-title">Search sold properties</h1>&nbsp; &nbsp; &nbsp; &nbsp; <div class="search-container">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="search-inner-container" style="z-index: 1;">&nbsp; &nbsp; &nbsp; &nbsp; <nav class="search-channel-container">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/buy" class="rui-search-tab">Buy</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/rent/" class="rui-search-tab">Rent</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/sold/" class="rui-search-tab rui-search-tab-selected">Sold</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/property/" class="rui-search-tab property-value-tab">Property value</a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="/find-agent" class="rui-search-tab find-agents-tab">Find agents</a>&nbsp; &nbsp; &nbsp; &nbsp; </nav>&nbsp; &nbsp; &nbsp; &nbsp; <div class="search-inner-container" style="z-index: 1;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="rui-search-container search-input-container">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <i class="rui-icon rui-icon-search search-icon"></i>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input name="where" id="where" tabindex="2" class="rui-input rui-location-box rui-auto-complete-input" data-auto-init="false" data-location-source="consumer-suggest" data-max-results="7" data-client-source="homepage" autocomplete="off" placeholder="Search by state, suburb or postcode" data-multi-select="true" data-suggest-types="suburb,precinct,region,state,postcode" data-auto-submit="false" autofocus=""><div class="clear-text-container"><a class="rui-icon rui-icon-cross" title="Clear text"> </a></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input name="theme" id="theme" type="hidden" value="rea.sold">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <button class="rui-search-button" tabindex="10">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="rui-visually">Search</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </button>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="focus-border" style="display: none;"></div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <section class="search-refinements" id="search-refinements">&nbsp; &nbsp; &nbsp; &nbsp; <div class="condition property-select-holder">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class="select-holder">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <label>All property types</label>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <select class="rui-input rui-select resize-select rui-select-rendered" id="rui-property-type-select-id" name="propertyType" multiple="multiple" style="display: none;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="All" selected="selected">All property types</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="House">House</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="unit apartment">Apartment &amp; Unit</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="Townhouse">Townhouse</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="Villa">Villa</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="Land">Land</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="Acreage">Acreage</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="Rural">Rural</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="unitblock">Block of Units</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <option value="retire">Retirement Living</option>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </select>&nbsp; &nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; &nbsp; &nbsp; .&nbsp; &nbsp; &nbsp; &nbsp; .&nbsp; &nbsp; &nbsp; &nbsp; .</body></html>更新但是,在尝试调用 urlhttps://www.realestate.com.au/sold/in-alice+springs+-+greater+region%2c+nt%3b/list-1'时,似乎通过指纹检测到了Selenium驱动的浏览器代理代码块:driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')driver.get("https://www.realestate.com.au/sold/in-alice+springs+-+greater+region%2c+nt%3b/list-1'")控制台输出:<html><head>&nbsp; &nbsp; <meta charset="UTF-8">&nbsp; &nbsp; <link rel="shortcut icon" href="about:blank"></head><body><script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/j.js"></script><script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/f.js"></script><script src="/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint/script/kpf.js?url=/149e9513-01fa-4fb0-aad4-566afd725d1b/2d206a39-8ed7-437e-a3be-862e0f06eea3/fingerprint&amp;token=34091693-e55f-5166-d979-67e9426e1030"></script></body></html>你可以在 Chrome 浏览器中找到相关的详细讨论,通过 ChromeDriver gets detected 启动
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python