Selenium Python Input on a virtual keyboard

Asked

Viewed 214 times

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

  • 1

    ready edited the post

  • Can it only be with IE? This is some restriction of the site?

  • Yes, only with IE it works. has restrictions it does not work with Chrome nor with Firefox

  • tries to put a time.sleep(10) after the browser.maximize_window(), can be that the element has not been loaded. otherwise try to lower the security settings from high to medium ie

  • another option is to see if this element is inside a iframe

  • 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.

  • I thought of it before an iframe, but it’s not inside an iframe.

  • 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.

  • put time.Sleep() yes put up to 20s even so it was not.

  • I tried to diminir the level of second but it gives me error the Selenium

  • can you get any other element? has how to pass the url?

Show 8 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.