0
I am facing a problem with Selenium, which is to log in to a page, but the problem is that when I get the element (name) or the element (ID) of the field it returns error telling me that that element does not exist.
this is the HTML code.
INPUT USER
<input name="txtUsuario" class="box" style="WIDTH: 100px" onkeydown="return onTecla(event)" onkeypress="return onTecla(event)" onfocus="return FieldClick(this);" type="text" maxlength="13"></input>
INPUT PASSWORD
<input name="pswSenha" class="box" id="pw" style="WIDTH: 50px" onkeydown="return onTecla(event)" onkeypress="return onTecla(event)" type="password" maxLength="99"></input>
all this is within a tag <div>
and within that tag <table>
, <tbody>
, <tr>
use that code
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Ie()
browser.get(URL)
browser.maximize_window()
elem = browser.find_element_by_name('txtUsuario')
elem.send_keys('usuario')
that’s the mistake he returns to me
selenium.common.exceptions.NoSuchElementException: Message: Unable to find element with css selector == [name="txtUsuario"]
someone has an idea of how to solve this ?
put the code you’re using, or this bit, because only with this can not help you
– Tmilitino
ready edited the post
– user153197
Can it only be with IE? This is some restriction of the site?
– Tmilitino
Yes, only with IE it works. has restrictions it does not work with Chrome nor with Firefox
– user153197
tries to put a
time.sleep(10)
after thebrowser.maximize_window()
, can be that the element has not been loaded. otherwise try to lower the security settings from high to medium ie– Tmilitino
another option is to see if this element is inside a
iframe
– Tmilitino
i tried to reap to the middle second level it returns me that Selenium.common.exceptions.Sessionnotcreatedexception: Message: Unexpected error Launching Internet Explorer. Protected Mode Settings are not the same for all Zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all Zones.
– user153197
I thought of it before an iframe, but it’s not inside an iframe.
– user153197
glued the
time.sleep
, as beast as it may seem, it may happen not to carry all the elements. I have faced a lot of this.– Tmilitino
apparently has the same problem that you
– Tmilitino
put time.Sleep() yes put up to 20s even so it was not.
– user153197
I tried to diminir the level of second but it gives me error the Selenium
– user153197
can you get any other element? has how to pass the url?
– Tmilitino