1
I’m setting up a system to automate a routine here in the company, but has a specific site that uses the field form
inside TD
's/TR
's, so I was using:
driver.FindElement(By.XPath("//input[@name='user']")).SendKeys("Teste");
But he returns to me:
Openqa.Selenium.Nosuchelementexception: 'Unable to find element with xpath == //input[@name='user']'
But validating Xpath in Chrome is correct.
Note: I tried using the FindElements
, there he finds, but I can’t get the command SendKeys
is not part of this.
Below also has the form HTML that I am accessing.
<tbody><tr><td colspan="2" bgcolor="#ffffff" align="center"><font size="3" face="Verdana"><b>Identificação do Usuário</b></font></td></tr>
<tr><td> </td></tr>
<tr>
<td><font size="2" face="Verdana"><b>Usuário</b></font></td>
<td align="right"><input name="user"></td>
</tr>
<tr>
<td><font size="2" face="Verdana"><b>Senha</b></font></td>
<td align="right"><input type="password" name="passwd"></td>
</tr>
<tr>
<td><font size="2" face="Verdana"><b>Ramal</b></font></td>
<td align="right"><input name="ramal" maxlength="10"></td>
</tr>
<tr><td> </td></tr>
<tr><td colspan="2" align="center">
<input type="submit" name="entrar" value="Acessar" style="width:100px" language="javascript" onclick="return entrar_onclick()">
<input type="submit" name="senha" value="Alterar Senha" style="width:100px" language="javascript" onclick="return senha_onclick()">
</td></tr>
You have not reported what language you are using, but try to change
xpath
forcss selector
and useinput[name=user]
as parameter to see if you have the desired result– Sorack
Sorry, I’m using C#
– Pedro Galocha
I had tested, but presents another error stating that did not identify. Openqa.Selenium.Nosuchelementexception: 'Unable to find element with css selector == input[name=user]'
– Pedro Galocha
you may have to put requests before and after the word user
– Sorack
Same situation Openqa.Selenium.Nosuchelementexception: 'Unable to find element with css selector == input[name='user']'
– Pedro Galocha
You are waiting for the screen to load before trying to access the element?
– Sorack
So I don’t use Thread to wait, because I use it on several other sites and I don’t have a problem, it’s just a Checklist system, the only site that’s giving me a headache is this. A Situation is simple, then "print" the screen and saved.
– Pedro Galocha
You saw that tag
input
is not being closed? It may have something to do with your problem– Sorack
you say in HTML? is third party application.
– Pedro Galocha
Closed, I selected the Iframe that was the TD/TR and managed to map through Xpath. Thank you.
– Pedro Galocha