leochabi / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 1 forks source link

Locator by ID #34

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Operating system : 7 Pro
.Net Framework version :
Office Version : 2013
SeleniumWrapper version : 1.0.16.0

What is your issue ?

I have a site that has two fields that I need to type into. The only tags 
within the HTML are type="text" and name="username". The issue is there are two 
fields with the same name on the page. So I need to type into the .Item(2) one. 
I can set the element to a declared variable, but can not figure out how to 
type into the Nth. 

When I type: chr.Type "name=username", "value" it tries to type into the first 
index, but I need it to type into the second index. 

Thanks in advanced for you assistance

Original issue reported on code.google.com by bjco...@gmail.com on 11 Dec 2013 at 3:39

GoogleCodeExporter commented 8 years ago
I was able to figure this out. 

Fix:
chr.Type "name=password index=1", "value"

Original comment by bjco...@gmail.com on 11 Dec 2013 at 3:50

GoogleCodeExporter commented 8 years ago
You can also use the Selenium 2 syntax:
chr.findElementsByName("password")(1).sendKeys "value"

Original comment by florentbr on 12 Dec 2013 at 2:38

GoogleCodeExporter commented 8 years ago
Is that even Safe? Could'nt they be monitoring your code would'nt they know 
where to go and how to get in?

Original comment by CodyLeeG...@gmail.com on 12 Jan 2014 at 5:23

GoogleCodeExporter commented 8 years ago

Original comment by florentbr on 8 Sep 2014 at 5:40