Use the following custom expression
import urllib
import urllib2
import ssl
from selenium import webdriver
driver = webdriver.Ie(capabilities=capabilities)
driver.get("Link to the login page")
image_path = driver.find_element_by_xpath('//img[@id = "vercodeimg"]')
src = image_path.get_attribute('src')
ssl._create_default_https_context = ssl._create_unverified_context
urllib.urlretrieve(src, r('Image file path)')
Result of the the above script will be a file which has Forbidden message.
An appropriate Src value is given to the image value which will be displayed if the link is clicked.
An image will be downloaded and when the image is opened in notepad, the below message is displayed.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head> <body>
<h1>Forbidden</h1>
<p>You don't have permission to access /simpleCaptcha
on this server.<br />
</p>
</body></html>
Expression:
drv = self.engine.get_driver()
print ">>>>>>>>" + url
import time
time.sleep(1)
js_str = """document.JiffyTargetUrl = arguments[0]; setTimeout(function() {
window.location=document.JiffyTargetUrl;
}, 500);"""
drv.execute_script(js_str,url)
print "ExecuteScript.. Done"
time.sleep(1)
inputvariable: url