This question already has answers here:
CSS selector for reCAPTCHA checkbok using Selenium and VBA Excel
(1 answer)
Find the reCAPTCHA element and click on it -- Python + Selenium
(2 answers)
How to click on the reCAPTCHA using Selenium and Java
(5 answers)
Closed 3 years ago.
I am trying to switch to iframe in captcha, but I get this error
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression "//iframe" is: [object HTMLIFrameElement]. It should be an element.
I tryed with switcing to Iiframe, but it doesnt work, I find iframe with inspecting element, but I can not find element when I run the script, also I added explicit wait, time sleep, but it still doesn't work
here is html code
<html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Access to this page has been denied.</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300" rel="stylesheet">
<style>
html, body {
margin: 0;
padding: 0;
font-family: 'Open Sans', sans-serif;
color: #000;
}
a {
color: #c5c5c5;
text-decoration: none;
}
.container {
align-items: center;
display: flex;
flex: 1;
justify-content: space-between;
flex-direction: column;
height: 100%;
}
.container > div {
width: 100%;
display: flex;
justify-content: center;
}
.container > div > div {
display: flex;
width: 80%;
}
.customer-logo-wrapper {
padding-top: 2rem;
flex-grow: 0;
background-color: #fff;
visibility: hidden;
}
.customer-logo {
border-bottom: 1px solid #000;
}
.customer-logo > img {
padding-bottom: 1rem;
max-height: 50px;
max-width: 100%;
}
.page-title-wrapper {
flex-grow: 2;
}
.page-title {
flex-direction: column-reverse;
}
.content-wrapper {
flex-grow: 5;
}
.content {
flex-direction: column;
}
.page-footer-wrapper {
align-items: center;
flex-grow: 0.2;
background-color: #000;
color: #c5c5c5;
font-size: 70%;
}
#media (min-width: 768px) {
html, body {
height: 100%;
}
}
</style>
<script src="/rw7M6iAV/captcha/PXrw7M6iAV/captcha.js?a=c&m=0&u=266c5db0-19e6-11ea-8150-878a39a29362&v="></script><style type="text/css">.px-loader-wrapper { display: flex;}#keyframes loadingEffect { 0% { background-position: 0; } 100% { background-position: 60vw; }}.px-inner-loading-area { width: 310px; height: 30px; animation-name: loadingEffect; animation-duration: 1.2s; animation-iteration-count: infinite; animation-timing-function: ease; animation-fill-mode: forwards; background: linear-gradient(to right, #F6F6F6 8%, #F0F0F0 18%, #F6F6F6 33%);}.px-loading-area { width: 310px; height: 30px; margin: 0; ;}</style><script src="/rw7M6iAV/init.js"></script><a tabindex="-1" aria-hidden="true" href="/organization/waldeck-associates?_pxhc=1575828688573" rel="nofollow" target="_blank" style="width: 0px; height: 0px; font-size: 0px; line-height: 0;"></a></head>
<body>
<section class="container">
<div class="customer-logo-wrapper">
<div class="customer-logo">
<img src="" alt="Logo">
</div>
</div>
<div class="page-title-wrapper">
<div class="page-title">
<h1>Please verify you are a human</h1>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div id="px-captcha" role="main"><style>#media screen and (max-width: 350px) {
#px-captcha {
position: relative;
right: 32px;
}
}</style><iframe style="display: block; width: 310px; height: 100px; border: 0; padding:0; margin: 0; -moz-user-select: none;-khtml-user-select: none;-webkit-user-select: none;-ms-user-select: none;user-select: none;" token="efbbf8834a03575dcd9c41ce37a32800bac150d7be5c1b3bf3a953f0879cfc3caa53da776440a3d731e03394daec916c92fe9416ba7947d3cea7370b970a551d"></iframe></div>
<p>
Access to this page has been denied because we believe you are using automation tools to browse the
website.
</p>
<p>
This may happen as a result of the following:
</p>
<ul>
<li>
Javascript is disabled or blocked by an extension (ad blockers for example)
</li>
<li>
Your browser does not support cookies
</li>
</ul>
<p>
Please make sure that Javascript and cookies are enabled on your browser and that you are not blocking
them from loading.
</p>
<p>
Reference ID: #266c5db0-19e6-11ea-8150-878a39a29362
</p>
<div id="px-block-form-wrapper"><div><style>#px-block-form-wrapper{width:400px;position:absolute;bottom:0;left:calc(50% - 200px)}#px-block-toggle-button{height:20px;background:#fff;color:#000;border-radius:3px;padding:10px;cursor:pointer;font-size:13px;text-align:center;width:270px;border:1px solid #000;font-weight:900;margin-left:75px;text-decoration:underline}#px-block-form{background:#fff;border:1px solid;border-color:#404040;color:#000;border-radius:3px;height:265px;font-size:12px}button#px-form-close{float:right;background:0 0;border:none;color:#fff;font-size:18px;cursor:pointer}button#px-form-submit{position:absolute;bottom:10px;background:#404040;border:none;width:100px;border-radius:3px;height:25px;color:#fff;right:20px;cursor:pointer}button#px-form-submit:disabled{background:#ddd;cursor:not-allowed;color:#000}div#px-form{color:#000;padding:15px}div#px-form-head{padding:10px;font-size:14px;background:#404040;color:#fff}div#px-form textarea{margin:-5px 0 0 4px;width:300px;height:36px}div#px-form div{margin-bottom:6px}#px-form-thank-you{background:#fff;color:#000;border:1px solid;border-color:#404040;border-radius:3px;height:54px;padding:5px 10px;text-align:center;width:330px;margin-left:35px}#px-form-thank-you div{font-size:15px;margin-top:14px}#px-form-thank-you span.checkmark{margin-right:8px;color:green;font-size:20px}div#px-form form h4{margin:8px 4px}#media only screen and (orientation:portrait){#px-block-form-wrapper{width:97%;position:relative;left:3%;z-index:10}#px-block-toggle-button{height:20px;background:#fff;color:#000;padding:3px;cursor:pointer;font-size:13px;text-align:center;width:94%;border:none;font-weight:900;text-decoration:underline;margin-left:0;position:fixed;bottom:5px;right:10px;width:initial}#px-block-form{background:#fff;border:1px solid;border-color:#404040;color:#000;border-radius:3px;height:250px;font-size:12px}button#px-form-close{float:right;background:0 0;border:none;color:#fff;font-size:18px;cursor:pointer;position:absolute;right:15px;padding:0;bottom:6px}button#px-form-submit{position:absolute;bottom:10px;background:#404040;border:none;width:100px;border-radius:3px;height:25px;color:#fff;right:20px;cursor:pointer;font-size:13px}button#px-form-submit:disabled{background:#ddd;cursor:not-allowed;color:#000}div#px-form{color:#000;padding:15px}div#px-form-head{padding:10px;font-size:14px;background:#404040;color:#fff;position:relative}div#px-form textarea{margin:-5px 0 0 4px;width:90%;height:36px}div#px-form div{margin-bottom:6px}#px-form-thank-you{background:#fff;color:#000;border:1px solid;border-color:#404040;border-radius:3px;height:54px;padding:5px 10px;text-align:center;width:94%;margin-left:0}#px-form-thank-you div{font-size:15px;margin-top:14px}#px-form-thank-you span.checkmark{margin-right:8px;color:green;font-size:20px}div#px-form form h4{margin:8px 4px}.container{display:block;position:relative}.container .content-wrapper{padding-bottom:40px}.container .page-footer-wrapper{position:fixed;bottom:0}.container .content-wrapper .content{margin:0 auto}}</style><div id="px-block-toggle-button" onclick="_pxToggleOpenForm()" hidden="">Report an issue</div><div id="px-block-form"><div id="px-form-head"><span>Experiencing issues? Let us know:</span> <button onclick="_pxToggleOpenForm(!0)" id="px-form-close">X</button></div><div id="px-form"><form><div style="display:none"><input onchange="_pxItemSelected()" type="radio" id="opt0" name="px-report-reason" value="-1"> <label for="opt0">I’m a bot</label></div><div><input onchange="_pxItemSelected()" type="radio" id="opt1" name="px-report-reason" value="1"> <label for="opt1">I don’t see any challenge</label></div><div><input onchange="_pxItemSelected()" type="radio" id="opt2" name="px-report-reason" value="2"> <label for="opt2">I keep solving the challenge</label></div><div><input onchange="_pxItemSelected()" type="radio" id="opt3" name="px-report-reason" value="3"> <label for="opt3">Other (please elaborate)</label></div><h4>Additional Information:</h4><textarea id="px-form-free-text" placeholder="Experiencing other issues?"></textarea></form><button disabled="disabled" id="px-form-submit" onclick="_pxSubmitForm()">Send</button></div></div><div hidden="" id="px-form-thank-you"><div><span class="checkmark">✓</span><span>Thank you for the feedback</span></div></div></div></div></div>
</div>
<div class="page-footer-wrapper">
<div class="page-footer">
<p>
Powered by
PerimeterX
, Inc.
</p>
</div>
</div>
</section>
<script>
window._pxAppId = 'PXrw7M6iAV';
window._pxJsClientSrc = '/rw7M6iAV/init.js';
window._pxFirstPartyEnabled = true;
window._pxVid = '';
window._pxUuid = '266c5db0-19e6-11ea-8150-878a39a29362';
window._pxHostUrl = '/rw7M6iAV/xhr';
</script>
<script>
var s = document.createElement('script');
s.src = '/rw7M6iAV/captcha/PXrw7M6iAV/captcha.js?a=c&m=0&u=266c5db0-19e6-11ea-8150-878a39a29362&v=';
var p = document.getElementsByTagName('head')[0];
p.insertBefore(s, null);
if (true) {
s.onerror = function () {
s = document.createElement('script');
var suffixIndex = '/rw7M6iAV/captcha/PXrw7M6iAV/captcha.js?a=c&m=0&u=266c5db0-19e6-11ea-8150-878a39a29362&v='.indexOf('captcha.js');
var temperedBlockScript = '/rw7M6iAV/captcha/PXrw7M6iAV/captcha.js?a=c&m=0&u=266c5db0-19e6-11ea-8150-878a39a29362&v='.substring(suffixIndex);
s.src = '//captcha.px-cdn.net/PXrw7M6iAV/' + temperedBlockScript;
p.parentNode.insertBefore(s, p);
};
}
</script>
</body></html>
The exception itself says that the selector is incorrect. Try to use absolute xpath while selecting the iFrame. Absolute xpath for captcha iframe always works for me.
Also it woulbe be great if you can share your automation code
Related
I am building a garage controller using Raspberry Pi with a Flask Server on it. Everything is working as expected except the fact that I still need to figure out how to automatically update the GPIO pin status and refresh the html page to open/close automatically.
I have attached my code below, any help would be appreciated.
The refresh status button you see right now is a workaround I created to refresh the page. But I am looking for something to refresh the page automatically per PIN status change.
Flask Code
import time
from datetime import datetime
from flask import Flask, render_template, request
import RPi.GPIO as GPIO
import logging
app = Flask(__name__)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, GPIO.PUD_UP)
GPIO.setup(7, GPIO.OUT)
#app.route("/", methods=['GET', 'POST'])
def Status():
if GPIO.input(16) == GPIO.LOW:
app.logger.info('Gate is Closed')
return render_template('Closed.html')
elif GPIO.input(16) == GPIO.HIGH:
app.logger.info('Gate is Open')
return render_template('Open.html')
#app.route("/Open", methods=['GET', 'POST'])
def Open():
GPIO.output(7, True)
app.logger.info('Gate is Opening')
return render_template('Open.html')
#app.route("/Closed", methods=['GET', 'POST'])
def Closed():
GPIO.output(7, False)
app.logger.info('Gate is Closing')
return render_template('Closed.html')
if __name__ == "__main__":
app.run()
HTML Code for Closed
<html>
<head>
<meta name="viewport" content="width=device-width">
<!--<meta http-equiv="refresh"
content="1; url = /" />-->
<!--<link rel="stylesheet" type="text/css" href="stylesheet.css">-->
<style>
.switch {
vertical-align: middle;
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.button {
color: #fff !important;
text-transform: uppercase;
text-decoration: none;
background: #000;
padding: 10px;
border-radius: 5px;
display: inline-block;
border: none;
transition: all 0.4s ease 0s;
}
.sliderWrapper{display: inline-block;margin:24px 24px 24px 24px;position:relative;}
.sliderWrapper div{display: inline-block;line-height:60px;}
</style>
<script type="text/javascript">
setTimeout (
function() { window.location.reload(); },
500
)
</script>
</head>
<body bgcolor="#ff5c33">
<center>
<br>
<h1>Gate Control</h1>
<br><br> <br> <br>
<h3>Use the toggle to Open/Close the Relay!</h3>
<form action="/Open">
<div class="sliderWrapper">
<div>Close </div>
<label class="switch">
<input type="checkbox" onclick="submit();">
<span class="slider round"></span>
</label>
<div> Open </div>
</div>
</form>
<div class="refresh">
<br><br>
<h3>Use the button to Refresh the Page/Status!</h3>
Refresh
</div>
</center>
</body>
</html>
HTML Code for Open
<html>
<head>
<meta name="viewport" content="width=device-width">
<!--<meta http-equiv="refresh"
content="1; url = /" />-->
<!--<link rel="stylesheet" type="text/css" href="stylesheet.css">-->
<style>
.switch {
vertical-align: middle;
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
.button {
color: #fff !important;
text-transform: uppercase;
text-decoration: none;
background: #000;
padding: 10px;
border-radius: 5px;
display: inline-block;
border: none;
transition: all 0.4s ease 0s;
}
.sliderWrapper{display: inline-block;margin:24px 24px 24px 24px;position:relative;}
.sliderWrapper div{display: inline-block;line-height:60px;}
</style>
<script type="text/javascript">
setTimeout (
function() { window.location.reload(); },
500
)
</script>
</head>
<body bgcolor="lightgreen">
<center>
<br>
<h1>Gate Control</h1>
<br><br> <br> <br>
<h3>Use the toggle to Open/Close the Relay!</h3>
<form action="/Closed">
<div class="sliderWrapper">
<div>Close </div>
<label class="switch">
<input type="checkbox" checked onclick="submit();">
<span class="slider round"></span>
</label>
<div> Open </div>
</div>
</form>
<div class="refresh">
<br><br>
<h3>Use the button to Refresh the Page/Status!</h3>
Refresh
</div>
</center>
</body>
</html>
You are running into how HTTP works in the classic client server way.
Your client in the front end request something from your server
if the requested resource/page is available the server responds. and sends it back to client.
Done
The above request/response cycle explains why your refresh button is needed.
In the past one way to work around this was to run some javascript/JQuery in the front end and periodically refresh the page (AJAX/long polling) And that will still work.
By now there are other ways too, for example use a (web)sockets to create a bi directional channel in which the server can push data to the client. Working around the problem you have with classic request/response. (Flask Socket IO for example)
Both ways are worth researching, but javascript to periodically poll will probably be the quickest if not the prettiest fix.
I am trying to create a webapp where, the data comes from a certain API and is saved into the database. Now, I want to create a pdf using the data. I had my html Code ready with custom css and bootstrap ( using display: flex; ). I already tried using the xhtml2pdf, reportlab libraries but am not able to get it right with CSS flex properties.
The source for the HTML, and some python file are attached below.
HTML File:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Invoice-ID</title>
<style type="text/css">
/* Bootstrap CSS */
.col-md-7 {
flex: 0 0 auto;
width: 58%;
}
.container {
width: 1320px;
}
.bg-light {
background-color: #f8f9fa !important;
}
.nav {
display: flex;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.justify-content-center {
justify-content: center;
}
.navbar {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
padding-top: .5rem;
padding-bottom: .5rem;
}
.navbar>.container-fluid {
display: flex;
flex-wrap: inherit;
align-items: center;
justify-content: space-between;
}
.navbar-light .navbar-brand {
color: rgba(0, 0, 0, .9);
}
.navbar-brand {
padding-top: .3125rem;
padding-bottom: .3125rem;
margin-right: 1rem;
font-size: 1.25rem;
text-decoration: none;
white-space: nowrap;
}
.flex-column {
flex-direction: column !important;
}
.d-flex {
display: flex !important;
}
.w-50 {
width: 50% !important;
}
.ms-2 {
margin-left: .5rem !important;
}
.p-3 {
padding: 1rem !important;
}
/* Custom CSS */
body {
font-weight: 300;
font-size: 14px;
}
.wrapper {
border: 2px solid gray;
border-width: 2px;
}
#location {
/* border: 2px solid gray; */
border-right: 1px solid gray;
border-width: 1px;
margin-bottom: 2rem;
}
.header {
font-size: 20px;
font-weight: 100;
text-align: center;
color: #007cae;
}
.title {
font-size: 22px;
font-weight: 100;
padding: 10px 20px 0px 20px;
}
.title span {
color: #007cae;
}
.details {
padding: 10px 20px 0px 20px;
text-align: left !important;
}
/* . {
margin-left: 455px;
} */
.hritem {
border: 1px solid gray;
border-width: 2px;
}
</style>
</head>
<body>
<div class="mt-5 container" style="border: 2px solid gray;">
<!-- Header Start -->
<div class="d-flex justify-content-center align-items-center">
<!-- <img src="E:\Python\Django web\logiswift\Deployment\main\static\assets\logo.png" alt="Logo" width="350px"> -->
<h1>LOGO</h1>
<div class="ms-auto">
<span><b>Some Text</b></span>
</div>
</div>
<hr class="hritem"/>
<div class="d-flex justify-content-center align-items-center">
<h3>Title</h3>
<div class="ms-auto ">
<p>Date: 12-12-2021</p>
<p>Document ID: 9868</p>
</div>
</div>
<!-- Header End -->
<hr class="hritem"/>
<!-- General Trip Info Start -->
<div class="d-flex">
<div class="w-50" id="location">
<p>
<h6>Current Location</h6>
<span>Address Line 1,</span>
<span>Address Line 2,</span>
<span>City,</span>
<span>State - PIN</span>
</p>
<p>
<h6>Expected Location</h6>
<span>Address Line 1,</span>
<span>Address Line 2,</span>
<span>City,</span>
<span>State - PIN</span>
</p>
</div>
<div class="w-50 ms-2 mt-3" id="consumer">
<h6>consumer Details</h6>
<hr/>
<p>
<span style="font-size: medium; font-weight: 400;"><b>Name: </b></span>
<span>Your Name</span>
</p>
<p>
<span style="font-size: medium; font-weight: 400;"><b>Consumer ID: </b></span>
<span>Unique Consumer ID</span>
</p>
</div>
</div>
<!-- General Trip Info End -->
<hr class="hritem"/>
<!-- Bill Start -->
<!-- <div>
<p>Bill Will Come here</p>
</div> -->
<!-- Bill End -->
<!-- <hr class="hritem"/> -->
<!-- Footer Start -->
<!-- <div>
<p>Additional info like address of the company and seal comes here.</p>
</div> -->
<!-- Footer end -->
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</body>
</html>
utils.py
from io import BytesIO
from django.http import HttpResponse
from django.template.loader import get_template
from xhtml2pdf import pisa
def render_to_pdf(template_src, context_dict={}):
template = get_template(template_src)
html = template.render(context_dict)
result = BytesIO()
pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")), result)
if not pdf.err:
return HttpResponse(result.getvalue(), content_type='application/pdf')
return None
view.py
def generatePDF(request):
template = get_template('main/invoices.html')
context = {
"date": datetime.date.today(),
}
html = template.render(context)
pdf = render_to_pdf('main/invoices.html', context)
return HttpResponse(pdf, content_type="application/pdf")
I don't understand why the above code isn't rendering the CSS flex attributes. I even tried to use the bootstrap classes inside the style tag, but the CSS flex won't come on rendering the PDF.
Please help me out.
Thanks in advance
I am building a website using flask-python, css, HTML.
I am not able to get transparent dropdown menu i changed the styling for css code and given proper code to HTML Layout.
The dropdown occurs in the center without any styling which i had speified in CSS styling
If i write the code in only in HTMl and CSS for dropdown menu.The drop down menu works perfectly fine.
Main python Script
from flask import Flask,render_template
import os
from flask import send_from_directory
app = Flask(__name__)
#app.route('/')
def home():
return render_template("home.html")
#app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')
#app.route('/projects/')
def projects():
return render_template("projects.html")
if __name__ == "__main__":
app.run(debug = True)
layout code layout.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<body>
<head>
<meta charset="utf-8">
<title>Developer | Krishan</title>
<link rel = "stylesheet" href ="{{ url_for('static' , filename = 'css/main.css') }}">
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<header>
<div class="container">
<h1 class = "logo">Krishan K B's Webpage</h1>
<strong><nav>
<ul class = "menu">
<li>Home</li>
<li>Projects
<ul class = "menu">
<li><a>Disaster Managment</a></li>
<li><a>Data Analytics</a></li>
<li><a>Volcanoes & Population</a></li>
<li><a>Games</a></li>
<li><a>Book App</a></li>
</ul>
</li>
</ul>
</nav></strong>
</div>
</header>
<div class = "container">
{%block content%}
{%endblock%}
</div>
</body>
</html>
Style css code style.css
body{
margin: 0 auto;
text-align: center;
font-family: brandon-grotesque,HelveticaNeue-Light,"Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
}
ul {
margin: 0px;
padding: 0px;
list-style : none;
}
ul li {
float : left;
width : 200px;
height : 40px;
background-color: #020202;
opacity : .8;
line-height: 40px;
text-align: center;
font-size: 20px;
margin-right: 2px;
}
ul li a {
text-decoration: none;
color : white;
display: block;
}
ul li a:hover {
background-color: green;
}
ul li ul li {
display: none;
}
ul li:hover ul li {
display: block;
}
h1{
text-align: center;
font-family: 'Yellowtail', cursive;
color: #e46922;
margin: 50px auto 0 auto;
font-size:60px;
}
h2{
color:#66bfbf;
text-align: center;
font-family:'monntserrat',sans-serif;
padding-bottom: 10px;
}
h3{
color: #11999e;
font-family:'monntserrat',sans-serif;
}
p{
line-height: 2;
width: 40%;
margin: 40px auto 60px;
}
hr{
border: dotted #eaf6f6 6px;
border-bottom: none;
width: 6%;
margin: 100px auto;
}
a{
color: #80b838;
font-family:'monntserrat',sans-serif;
margin: 10px 20px;
text-decoration: none;
}
a:hover{
color: #eaf6f6;
}
.head{
color: #66bfbf;
font-size: 140%;
}
.top{
background-color: #E4F9F5;
position: relative;
padding-top: 100px;
}
.middle{
margin: 100px 0;
}
.bottom{
background-color: #66bfbf; ;
padding: 50px 0 10px;
}
.intro{
width: 30%;
margin: auto;
}
.top-cloud{
position: absolute;
right: 180px;
top: 30px;
}
.below-cloud{
position: absolute;
left: 150px;
bottom: 230px;
}
.img{
float: left;
margin-left: 320px;
}
.img-code{
float: right;
margin-right: 320px;
}
.skils{
width: 30%;
margin: auto;
}
.copyright{
color: #eaf6f6;
font-size: 0.75rem;
}
.contact-message{
width: 40%;
margin: 40px auto 60px;
}
.contact{
padding-bottom: 100px;
}
.btn {
margin: 100px;
background: #45b29a;
background-image: -webkit-linear-gradient(top, #45b29a, #45b29a);
background-image: -moz-linear-gradient(top, #45b29a, #45b29a);
background-image: -ms-linear-gradient(top, #45b29a, #45b29a);
background-image: -o-linear-gradient(top, #45b29a, #45b29a);
background-image: linear-gradient(to bottom, #45b29a, #45b29a);
-webkit-border-radius: 6;
-moz-border-radius: 6;
border-radius: 6px;
font-family: Arial;
color: #1b7f69;
font-size: 21px;
padding: 10px 20px 10px 20px;
text-decoration: none;
}
.btn:hover {
background: #45b29a;
background-image: -webkit-linear-gradient(top, #45b29a, #1b7f69);
background-image: -moz-linear-gradient(top, #45b29a, #1b7f69);
background-image: -ms-linear-gradient(top, #45b29a, #1b7f69);
background-image: -o-linear-gradient(top, #45b29a, #1b7f69);
background-image: linear-gradient(to bottom, #45b29a, #1b7f69);
text-decoration: none;
}
Output i received :
enter image description here
I think your css is not properly rendered by flask, you need to hard reload
After this go to developers tool > sources tab , then search for the css file and crosscheck whether it is properly rendered or not.
Thanx i did hard reload and it worked but now i am not able to see the dropdown or any menu in my home page but i can see it in my projects webpage when i type /projects/ with the web address local host on URL. All the css styling changes are working perfectly fine but now there is no options menu in in my HomePage.
This is my homepage with no dropdown or any menu options to go to projects webpage :
enter image description here
This is my projects webpage, in this there is a dropdown and a menu with all the styling.
enter image description here
Homepage Code:
{%extends "layout.html"%}
{%block content%}
<div class = "home">
<div class="top">
<img class="top-cloud" src="{{ url_for('static' , filename = 'images/clo.png') }}" alt="cloud-img" height="200px">
<h1> I'm Krishan.</h1>
<p class="head">A Back End Developer.</p>
<img class="below-cloud" src="{{ url_for('static' , filename = 'images/clo.png') }}" alt="cloud-img" height="200px">
<img src="{{ url_for('static' , filename = 'images/land.svg') }}" alt="mounntains-img" height="350px">
</div>
<div class="middle">
<img class="profile" src="{{ url_for('static' , filename = 'images/profile.png') }}" alt="profile" height="150px" >
<h2>Hi.</h2>
<P class="intro"> I'm a Programme developer,web developer and designer,UI Designer based in Bangalore,India.I have a passion for web app,data analytics,web design,data analytics and coding and love to create new apps,website for web and mobile devices.</P>
</div>
<hr>
<div>
<h2>What I can do.</h2>
<img class="img" src="{{ url_for('static' , filename = 'images/coding.png') }}" alt="" height="150px" >
<p>I like to keep it simple. My goals is to develop a new programme which would be beneficial for the people and be enviromen friendly.</p>
</div>
<hr>
<div class="skill">
<h2>Develop what you need.</h2>
<img class="img-code" src="{{ url_for('static' , filename = 'images/code-img.png') }}" alt="" height="150px" >
<p class="skills">I'm a developer, so I know how to create your website,application or any other programme to run across devices using the latest technologies available.</p>
</div>
<hr>
<div class="contact">
<h2>Get in touch.</h2>
<h3>I’m currently available for freelance work.</h3>
<p class="contact-message">if you have a project that you want to get started, think you need my help with something or just fancy saying hey, then get in touch.</p>
<a class="btn" href="mailto:krishankbhushan#gmail.com">message me</a>
</div>
</div>
<div class="bottom">
<a class="footer-link" href="https://www.linkedin.com/in/krishan-k-b-0a164b125/">Linkedin</a><i class="fab fa-twitter"></i>
<a class="fab fa-twitter" href=" https://twitter.com/krishankbhushan"><i class="fa fa-twitter"></i>Twitter</a>
<i class="fa fa-twitter" style="font-size:24px"></i>
<p class="copyright">©️ 2021 Krishan.All rights reserved.</p>
</div>
</div>
{%endblock%}
So I am at the last couple details of my portfolio website, and everything has gone relatively smoothly. I have not had an issue with images before, but this time I am using a {% for loop %} to iterate over the code for the card and I just have the variable template tags that create a new object every time I add something new in the django admin interface.
I feel like there is some small detail I am just completely missing, because I had it working at one point, but then decided to do the iteration instead of hard-coding it in, and it just won't show up. Another pair of eyes would be nice.
This is the section of my index.html:
{% block content %}
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jordan Miracle</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/static/portfolio/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<body>
<div class="jumbotron text-center ui-datepicker-next-hover" style="margin-bottom:0">
<div class="align-center">
<img src="{% static 'portfolio/mylogo.png' %}" id="img-bastet" class="img-fluid"
alt="Jordan and Bastet">
</div>
<h1><p style="font-family: 'Ubuntu Mono', Monospaced, monospace; font-size: medium;">Developer and Aspirant Data
Scientist</p>
</div>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
<a class="navbar-brand" href="{% url 'home' %}">Home</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="https://github.com/jordanmiracle">Github</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://twitter.com/jordanmiracle1">Twitter</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.linkedin.com/in/jordan-m-605b4b1a9/">LinkedIn</a>
</div>
<div class="topnav-right">
Blog
</nav>
<div class="container" style="margin-top:30px">
<div class="row">
<h2>About Me</h2>
<div class="row justify-content-center my-3">
<div class="col-5" style="border: #303030" aria-setsize="10px">
<img src="{% static 'portfolio/me-bastet-and-babys-turtle.jpg' %}" class="img-fluid"
alt="Jordan and Bastet">
</div>
</div>
<div class="intro-text">
<p style="font-family: 'Ubuntu Mono', Monospaced, monospace; font-size: small; ">
<p>I enjoy web development, and have a true love for analyzing data. Whether creating visualizations and
interpreting what I find,<br>
or creating a machine learning model to try and make predictions. <br>
Things that interest me the most are the climate and our ecosystem, consciousness, and the cosmos that we live
in.
</p>
</div>
<ul class="nav nav-pills flex-column">
<div class="button-row-main">
<button class="nav-button highlight-green">
<a href="mailto:jordanmiracle#protonmail.com" target="_blank">Contact
Me</a>
</button>
</div>
<div class="portfolio">
{% for project in projects %}
<div class="project">
<h2>{{ project.title }}</h2>
<p class="technologies">
</p>
<!-- Depending on availability, display either the image as a link,
only image, or a string explaining that the img is missing-->
{% if project.image %}
<a href="{{ project.url }}" target="_blank">
<div class="img-container" style="background-image: url('{{ project.image }}')"></div>
</a>
<p>{{ project.description }}
</p><br>
<div class="project-links">
Live Site
Code
</div>
{% endif %}
</div>
{% endfor %}
</body>
{% endblock %}
</html>
My style.css:
font-family: 'Oswald', sans-serif;
text-align: center;
background-color: #00FF00;
color: #303030;
}
/* ---------- HOME ---------- */
/* create color-hover-effect for M logo and buttons */
.highlight-orange:hover {
color: #417FD5;
border-color: #ffa000;
}
.highlight-green:hover {
color: darkred;
border-color: indianred;
}
button a {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
text-decoration: darkslateblue;
color: inherit;
/* increase the clickable area */
display: inline-block;
position: relative;
z-index: 1;
padding: 1.3em;
margin: -1.3em;
}
.nav-button {
font-size: 1.1em;
margin: 20px;
padding: 10px;
border: 2px solid #303030;
border-radius: 25px;
color: #303030;
background-color: #fdfdfd;
box-shadow: #417FD5;
}
.button-row-mobile,
.button-row-portfolio-mobile {
display: none;
}
/* ---------- PORTFOLIO ---------- */
.portfolio {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.project {
margin: 20px;
padding: 20px;
border: 3px solid #303030;
border-radius: 20px;
color: transparent;
background-color: transparent;
max-width: 300px;
}
.project-links {
display: flex;
justify-content: space-around;
}
.project-links a {
color: #4DAAE3;
}
.project-links a:visited {
color: #ffffff;
}
.project-links a:hover {
color: #4DAAE3;
}
.button-row-portfolio {
position: fixed;
width: 100%;
justify-content: space-between;
bottom: 5px;
}
.button-row-portfolio .nav-button {
opacity: 0.8;
}
/*
restrict img to uniform size automatically,
while showing the center portion of the screenshot. adapted from:
https://stackoverflow.com/questions/15866223/how-to-make-images-get-cut-off
*/
.img-container {
height: 200px;
width: 250px;
color: transparent;
background-position: center;
border: 1px solid #303030;
border-radius: 20px;
background-repeat: no-repeat;
}
/* ---------- FOOTER ---------- */
.separator {
display: none;
}
#footer {
position : absolute;
bottom : 0;
height : 40px;
margin-top : 40px;
}
footer {
font-size: 16px;
color: #303030;
}
.site-footer {
padding-left: 40px;
padding-right: 40px;
padding-top: 15px;
padding-bottom: 5px;
background-color: #aa2222;
color: white;
font-style: italic;
text-align: center;
}
.icon {
height: 36px;
width: auto;
padding: 8px;
}
.overflow {
color: #fdfdfd;
font-size: 2.5em;
}
/* ---------- RESPONSIVE ELEMENTS ---------- */
/* TODO: remove blue highlighting when buttons are clicked */
#media only screen and (max-width: 768px) {
.logo {
font-size: 14em;
}
.button-row-main,
.button-row-portfolio {
display: none;
}
.button-row-mobile {
margin-top: 50px;
margin-bottom: 50px;
display: flex;
justify-content: space-around;
}
.button-row-portfolio-mobile {
display: flex;
position: fixed;
width: 100%;
justify-content: space-around;
bottom: 5px;
}
.button-row-portfolio-mobile .nav-mobile {
opacity: 0.8;
}
.nav-mobile {
font-family: 'Oswald', sans-serif;
font-size: 1em;
border: none;
border-radius: 100px;
background-color: #fdfdfd;
}
.highlight-orange {
color: #4DAAE3;
border-color: #4DAAE3;
fill: #4DAAE3;
}
.highlight-green {
color: lightgreen;
border-color: lightgreen;
fill: lightgreen;
}
.highlight-blue {
color: lightblue;
border-color: lightblue;
fill: lightblue;
}
.separator {
display: block;
}
footer {
margin-top: 24px;
}
.icon {
height: 45px;
width: auto;
padding: 20px;
}
}
* {
box-sizing: border-box;
}
body {
background-color: #f1f1f1;
padding: 20px;
font-family: "Ubuntu Mono", serif;
}
/* Center website */
.main {
max-width: 1000px;
margin: auto;
}
h1 {
font-size: 50px;
word-break: break-all;
}
.row {
margin: 8px -16px;
}
/* Add padding BETWEEN each column (if you want) */
.row,
.row > .column {
padding: 8px;
}
/* Create four equal columns that floats next to each other */
.column {
float: left;
width: 25%;
}
/* Clear floats after rows */
.row:after {
content: "";
display: table;
clear: both;
}
/* Content */
.content {
background-color: white;
padding: 10px;
}
/* Responsive layout - makes a two column-layout instead of four columns */
#media screen and (max-width: 900px) {
.column {
width: 75%;
}
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.column {
width: 100%;
}
}
My models.py:
class Project(models.Model):
title = models.CharField(max_length=100)
description = models.CharField(max_length=120)
image = models.FilePathField(path='portfolio/images')
url = models.URLField(blank=True)
code_url = models.URLField(blank=True)
def __str__(self):
return self.title
Here is my file structure.
If anybody needs more information, or if I need to provide more details, just let me know. This is the last thing really standing in my way of deploying and it's been a pain.
Before changing it to img class
After changing it from a div class to img class
The images needed to be registered properly in the Django admin shell.
Once in the shell, I had to import the models.
from portfolio.models import Project
Then, p2 = Project.objects.get(id=2)
p2.image = <path_to_file>
And so on. Once they were registered in the DB, they popped up right away.
Looks like you might need to set a background image size on .img-container. If that doesn't work, also try setting display: block;
.img-container {
height: 200px;
width: 250px;
color: transparent;
background-position: center;
border: 1px solid #303030;
border-radius: 20px;
background-repeat: no-repeat;
background-size: cover;
display: block;
}
I have been trying to write a program to automate my work.
My task has series of steps but I am stuck at one point. I am constantly getting NoSuchElementException.
I have tried to use id, class, name methods of Selenium but nothing seems to work. My present code is this:
from selenium import webdriver
from selenium.webdriver.common.by import By
browser = webdriver.Chrome('C:\\Users\\abc\\AppData\\Local\\Programs\\Python\\Python36\\chromedriver.exe')
browser.get("http://example.com/login.aspx")
usernameElem = browser.find_element_by_id('txtuser')
usernameElem.send_keys('admin')
passwordElem = browser.find_element_by_id('txtpassword')
passwordElem.send_keys('password')
loginElem = browser.find_element_by_id('btn_login')
loginElem.click() # follows the "Read It Online" link
browser.get("http://example.com/Reports.aspx")
subscriberslistElem = browser.find_element_by_id('ContentPlaceHolder1_rptDC_lnk_0')
subscriberslistElem.click()
browser.implicitly_wait(3)
entityElem = browser.find_element_by_id("report_Entity_ClientState")
print("Test")
entityElem.send_keys('Entity1')
browser.implicitly_wait(3)
reportElem = browser.find_element_by_class_name('selectbox')
print("Test 2")
reportElem.click()
showdataElem = browser.find_element_by_id('btn_new')
showdataElem.click()
excelElem = browser.find_element_by_id('imgExport')
excelElem.click()
print('All is well')
Link to webpage, complete files.
It's strange that when I opened HTML file online as code and searched 'report_Entity_ClientState' there were no results.
Images of elements I am trying to access:
First element.
Second element.
Both the entity and report element are not found. Following parts of code return error.
entityElem = browser.find_element_by_id("report_Entity_ClientState")
reportElem = browser.find_element_by_class_name('selectbox')
entityElem.send_keys('Entity1')
browser.implicitly_wait(3)
HTML code of elements:
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>
</title>
<style type="text/css">
.rgDataDiv
{
height: 350px !important;
}
#report2_demo1_dateInput, #report2_demo2_dateInput
{
background: none repeat scroll 0 0 #f0f3f4;
border: 1px solid #4D87A5;
border-radius: 0.3em;
color: #296872;
font-family: "HelveticaNeue-Light" , "Helvetica Neue Light" , "Helvetica Neue" ,Helvetica,Arial, "Lucida Grande" ,sans-serif;
font-size: 14px;
font-weight: 400;
height: 1.8em;
padding: 0 0.3em;
position: relative;
text-align: center;
text-shadow: 1px 1px 0 #FFFFFF;
}
.selectbox
{
width: 175px;
height: 27px;
background-color: #FFF;
border: 1px solid #b7b7b7;
font: 400 12px/18px 'Open Sans' , sans-serif;
color: #777;
font-weight: bold;
border: 1px solid #ccc;
margin: 0em 0.5em;
padding: 0em 0.5em;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}
.selectbox:hover
{
border: 1px solid #1261ac !important;
}
.selectbox option
{
padding: 5px;
}
.button
{
background-color: #23ad44;
background-image: linear-gradient(to bottom, #23ad44, #23ad44);
border: 1px solid #23ad44;
border-radius: 3px;
color: #ffffff;
display: inline-block;
font-family: arial,helvetica,sans-serif;
font-size: 12px;
font-weight: bold;
margin-left: 5px;
padding: 7px;
text-align: center;
text-decoration: none;
width: 7em;
}
.button:hover
{
background-color: #23ad44;
background-image: linear-gradient(to bottom, #23ad44, #23ad44);
border: 1px solid #23ad44;
}
</style>
<style type="text/css">
#overlay
{
background-color: #000000;
height: 100%;
left: 0;
opacity: 0.6;
position: fixed;
top: 0;
width: 100%;
z-index: 1500;
}
#theprogress
{
background-color: #000000;
border: 0 solid #CCCCCC;
height: 30px;
line-height: 30px;
opacity: 0.6;
padding: 10px;
text-align: center;
width: 300px;
}
#modalprogress
{
position: absolute;
top: 45%;
left: 50%;
margin: -11px 0 0 -150px;
color: #990000;
font-weight: bold;
font-size: 14px;
}
.RepeaterLabel
{
color: #2980b9;
}
</style>
<link href="/WebResource.axd?d=YhrvG3mKYx0qi8zmG_e2lyIXyb_ANuRBo_sKLQFJLSvTN5PZ_1mAdbAu2oYdNj8IQ2baXlFznJaZLu1FNyX1Sw2&t=634968929080000000" type="text/css" rel="stylesheet" class="Telerik_stylesheet"><link href="/WebResource.axd?d=pgzM84zOvBy03oK1BX9qj4AemgkqjvEpKd1DaZn3BmX7HYCaCPA9mDXES3WITAYhGWLhU3BijsiI-NqfoTxwKTiVY41t_WUGeTj39PR75xY1&t=634968929080000000" type="text/css" rel="stylesheet" class="Telerik_stylesheet"></head>
<body>
<form method="post" action="Rep1_SubList.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="">
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="">
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTIwNjA3NzE2NzEPZBYCAgMPZBYCAgEPZBYCZg9kFggCBQ8UKwACDxYEHgtfIURhdGFCb3VuZGceF0VuYWJsZUFqYXhTa2luUmVuZGVyaW5naGQPFCsAAhQrAAIPFgIeBFRleHQFA0FMTGRkFCsAAg8WBB8CBQhTUENHMDAzMx4FVmFsdWUFCFNQQ0cwMDMzZGQPFCsBAmZmFgEFd1RlbGVyaWsuV2ViLlVJLlJhZENvbWJvQm94SXRlbSwgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMy4xLjIyMC40MCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0FghmDw8WBB4IQ3NzQ2xhc3MFCXJjYkhlYWRlch4EXyFTQgICZGQCAQ8PFgQfBAUJcmNiRm9vdGVyHwUCAmRkAgIPDxYCHwIFA0FMTGRkAgMPDxYEHwIFCFNQQ0cwMDMzHwMFCFNQQ0cwMDMzZGQCCQ8QZGQWAWZkAgsPEGRkFgFmZAIVDzwrAA4CABQrAAJkFwEFCFBhZ2VTaXplAhQBFgIWC2RkZRQrAAALKXlUZWxlcmlrLldlYi5VSS5HcmlkQ2hpbGRMb2FkTW9kZSwgVGVsZXJpay5XZWIuVUksIFZlcnNpb249MjAxMy4xLjIyMC40MCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj0xMjFmYWU3ODE2NWJhM2Q0ATwrAAcACyl0VGVsZXJpay5XZWIuVUkuR3JpZEVkaXRNb2RlLCBUZWxlcmlrLldlYi5VSSwgVmVyc2lvbj0yMDEzLjEuMjIwLjQwLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPTEyMWZhZTc4MTY1YmEzZDQBZGRkZGYWAmYPFCsAAhQrAAIUKwACZGRkZGQYAgUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFDXJlcG9ydF9FbnRpdHkFDXJlcG9ydF9FbnRpdHkPFCsAAmVlZLr0AotH53uxPGSh7QymTeWwsdUnInQbJfo/1AqZAer9">
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=WPqzNIAf0aRvfZ51T5FqAw2&t=636265663681012204" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=0-K2f-KkPKroL1v8HQRfqOW6Bm5xtYnbtzo_BRMK3-orTVPkM3P6U7R-O_kYNMldQbgeLIbAfjb5i99L3QDP87wvzxMxirCvs4zeaZ5iCvg1&t=16ab2387" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
//]]>
</script>
<script src="/ScriptResource.axd?d=0-K2f-KkPKroL1v8HQRfqOW6Bm5xtYnbtzo_BRMK3-orTVPkM3P6U7R-O_kYNMldkzOjZKCZKI8dbMwhU6puwXriFBMbrnAMLgehz7nDFguuKxruf9QzOB5sQpy88shJ0&t=16ab2387" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCdnEq-SEy_US1KuLZmEnoxm0&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCcCRUgx0Nxj77KymelI6SbiewHQsPnET8txjQRIhxv9ow2&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCf49iuFjicOUhj3AUMkpbwDvPtFtRMJzCdeNbcfmY9RdA2&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCcStsFzhAvG6xzv928b3E8L1Pt9Gjfq_pIz-VgKJtG5wQ2&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCdT9MJqqpr-t50oq7GfpGoHVIJkcb_99EGhaoMesY6BL_Y4gIEI-tQ29AH-8m3OqeM1&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCdT9MJqqpr-t50oq7GfpGoHGGMRnTUBSrYO6OmjVxnhB1zYMtRDZSpvvOn8lbJO5tQ1&t=ffffffffcf4a174e" type="text/javascript"></script>
<script src="/ScriptResource.axd?d=uLRCwOuJA-xwtRRow_E7Hq0v5K1DXj8YRZ2chYicyCfUqwvvfXR2C1xI7mel65lGuhK3m71Yx952aE6WQ4vkzg2&t=ffffffffcf4a174e" type="text/javascript"></script>
<div class="aspNetHidden">
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBgL/046PAQLBv5udDwLBv5udDwLO0LHzAwLP0LHzAwL9nO2QARGzTJ5Kcho1tzVM3gIXWgrV275r13MCRT/Kb4EgrVKR">
</div>
<div id="pnlMain">
<div id="UpdateProgress1" style="display:none;" role="status" aria-hidden="true">
<div id="overlay">
<div id="modalprogress">
<div id="theprogress">
<i style="background: #ffffff;" class="fa fa-spinner fa-spin fa-3x stat-elem"></i>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('scrpt1', 'form1', ['tpnlMain','pnlMain'], [], [], 1000, '');
//]]>
</script>
<div>
<div>
<table>
<tbody><tr>
<td>
<div id="report_Entity" class="RadComboBox RadComboBox_Silk" style="width:160px;white-space:normal;">
<!-- 2013.1.220.40 --><table summary="combobox" style="border-width:0;border-collapse:collapse;width:100%" class="">
<tbody><tr>
<td class="rcbInputCell rcbInputCellLeft" style="width:100%;"><input name="report_Entity" type="text" class="rcbInput radPreventDecorate rcbEmptyMessage" id="report_Entity_Input" value="Select Entity" autocomplete="off"></td><td class="rcbArrowCell rcbArrowCellRight"><a id="report_Entity_Arrow" style="overflow: hidden;display: block;position: relative;outline: none;">select</a></td>
</tr>
</tbody></table><div class="rcbSlide" style="z-index:6000;"><div id="report_Entity_DropDown" class="RadComboBoxDropDown RadComboBoxDropDown_Silk " style="display:none;"><div class="rcbScroll rcbWidth" style="height:200px;width:100%;"><ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;"><li class="rcbItem ">ALL</li><li class="rcbItem ">SPCG0033</li></ul></div></div></div><input id="report_Entity_ClientState" name="report_Entity_ClientState" type="hidden" autocomplete="off">
</div>
</td>
<td>
<select name="report_Type" onchange="javascript:setTimeout('__doPostBack(\'report_Type\',\'\')', 0)" id="report_Type" class="selectbox">
<option selected="selected" value="">Report Type</option>
<option value="1">Total Subscriber List</option>
<option value="2">Subscriber List with Active Package</option>
</select>
</td>
<td>
</td>
<td>
<input type="submit" name="btn_new" value="Show Data" id="btn_new" class="button">
</td>
<td>
</td>
<td>
</td>
</tr>
</tbody></table>
</div>
<span id="lbl_error" style="color:White;font-weight:bold;"></span>
<div>
</div>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
Sys.Application.add_init(function() {
$create(Sys.UI._UpdateProgress, {"associatedUpdatePanelId":"pnlMain","displayAfter":0,"dynamicLayout":true}, null, null, $get("UpdateProgress1"));
});
WebForm_InitCallback();Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadComboBox, {"_dropDownWidth":0,"_height":200,"_postBackReference":"__doPostBack(\u0027report_Entity\u0027,\u0027arguments\u0027)","_skin":"Silk","_uniqueId":"report_Entity","clientStateFieldID":"report_Entity_ClientState","collapseAnimation":"{\"duration\":450}","emptyMessage":"Select Entity","expandAnimation":"{\"duration\":450}","itemData":[{},{"value":"SPCG0033"}],"localization":"{\"AllItemsCheckedString\":\"All items checked\",\"ItemsCheckedString\":\"items checked\",\"CheckAllString\":\"Check All\"}","markFirstMatch":true}, null, null, $get("report_Entity"));
});
//]]>
</script>
</form>
</body></html>
If you look at the <input id="report_Entity_ClientState" ... > node the type is hidden. So we have to unhide the WebElement first and send the chars as follows:
entityElem = browser.find_element_by_xpath("//input[#id='report_Entity_ClientState']")
browser.execute_script("arguments[0].removeAttribute('type')", entityElem);
entityElem.send_keys('Entity1')
browser.switch_to.frame("ContentPlaceHolder1_myIframe")
I had to add this line just before trying to find an element. Now all the methods mentioned by #DebanjanB and #Ratmir Asanov works perfectly. Thank you for your constant support.