Unable to retrieve page_source using IE11 and Selenium using Python

user5524535
driver = webdriver.Ie()
driver.implicitly_wait(5)
url = "http://nontax.hebcz.cn"
driver.get(url)
driver.maximize_window()
print("=======")
print(driver.page_source)
print("=======")

This is my code and it print nothing

Selenium 2.53.1

I've added the Reg and changed IE's security options

What can i do???

DebanjanB

You haven't mentioned if you are seeing any error. However, using Selenium v3.141.0 I'm able to extract the page_source as per the solutionbelow:

Code Block:

from selenium import webdriver

driver = webdriver.Ie(executable_path=r'C:\WebDrivers\IEDriverServer.exe')
driver.get('http://nontax.hebcz.cn/')
print("Page title is: %s" %(driver.title))
print("=======")
print(driver.page_source)
print("=======")
driver.quit()

Console Output:

Page title is: 河北省非税云缴费平台-
=======
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">

<meta name="viewport" content="width=1200">
<meta name="_csrf" content="711baa60-38b0-4328-8704-f404f3d08c49">
<title>河北省非税云缴费平台-</title>
<script src="/static/js/jquery-1.9.1.min.js"></script>
<link href="/static/images/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link href="/static/css/style.css" rel="stylesheet" type="text/css">
<script src="/static/js/zzsc.js" type="text/javascript"></script>
<script type="text/javascript">var footer_Positon =0;$(function () {var token =$("meta[name='_csrf']").attr("content");$(document).ajaxSend(function(e,xhr,options) {xhr.setRequestHeader("CSRFToken",token);});});$(document).ready(function(){var usernav =document.getElementById('usernav');var u =document.getElementById('u');u.onmouseover=function(){usernav.style.display='block'
}
u.onmouseout=function(){usernav.style.display='none'
}
})
</script>
<script type="text/javascript">function unUsed() {alert("缴费大厅暂未开放,请耐心等候!");}
function unInvoice() {alert("国庆间暂停访问!");}
</script>
<style>.footer{height:99px;width:100%;position:fixed;bottom:0;}</style>
</head>
<body>
<div style="min-width: 1200px;">
<div class="top_head">
<div class="topnav">
<ul>
<li><a href="/static/getIndex">首页 </a></li>
<li id="u">
<a href="#">用户中心 <span class="pot"></span></a>
<div class="user_list" id="usernav">
<span class="list_cur"><a href="/web/main/view?path=web/user/userInfo">个人信息</a></span>
<span><a href="/web/main/view?path=web/paycenter/payorderlist">缴费列表</a></span>
<span><a href="/web/main/view?path=web/paycenter/pay">常用缴费</a></span>
<span><a href="/web/main/view?path=web/paycenter/electronic-bill">电子票据</a></span>
</div>
</li>
<li><a href="/unit/main/view?path=unit/index">电子票据</a></li>
<li><a href="/bill/billCheck">票据查验</a></li>
<li><a href="/static/getInfoList?type=notice">工作动态</a></li>
<li><a href="/static/getInfoList?type=news">政策规定</a></li>
<li><a href="/static/getInfoList?type=laws">办事指南</a></li>
</ul>

</body></html>
=======

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Unable to extract page tittle and page_source using IEDriverServer and Selenium through Python

Python, using Selenium how to clean page_source from char like /a0:

Unable to retrieve the href attributes using Python and Selenium

Unable to focus an input using JavaScript in IE11

Unable to switch to a new window when using IE11

python selenium - click button and get page_source

How to set the page_source of selenium yourself in python3?

Why am I unable to retrieve the full list of cookies when using Selenium with Python3?

Retrieve updated url in selenium using python

Retrieve href value using python selenium

How to retrieve the text of a WebElement using Selenium - Python

Error using Selenium (Python): Unable to find class in HTML source code

Unable to retrieve links using beautiful soup and python

Unable to scraping a review page using python,selenium and beautiful soup

Unable to find `class` on a Google page using selenium and python

Unable to retrieve the data/array behind Javascript chart using Selenium (headless)

Unable to retrieve page 2 using POST request

selenium Unable to find elements on closed window when navigate to other page on IE11

IE11 shows page source instead of content when using the jump list

Unable to launch IE browser using Selenium Webdriver

Python: Unable to import Selenium using Jupyter

Unable to select drop down using Python Selenium

Unable to login to Quora using Selenium webdriver in Python

Unable to click link using selenium webdriver in python

Unable to play YouTube video using Selenium with Python

Unable to delete input field using selenium and python

Unable to click on link using python and selenium

Unable to reach the website using selenium with proxy in Python

Unable to locate element using selenium webdriver in python