- suleeActive particpant
- Posts : 14
Join date : 2010-12-27
getAllFields() function returns only one element always, help!
Mon Jan 10, 2011 3:20 pm
Hi all,
I am writing this piece of code to get the ids of the input fields on the page:
String buttons[] = selenium.getAllFields();
System.out.println("# buttons " + buttons.length);
for(int j =0; j {
System.out.println("id = " + buttons[j]);
System.out.println("value = " + selenium.getValue(buttons[j]));
}
And the page is log on page of gmail, there are 2 input fields: Email and password yet the function getAllFields() just returns the Email field. And the length is always 1. I also tried the getAllButtons() and getAllWindows() function but nothing changes. Length is still 1 altough there are more than 1 fields. can anybody help me? Thank you.
I am using Eclipse Helios and Junit3 tests. Platform is windows xp professional. And here is the full code and the output:
package com.example.tests;
import org.apache.tools.ant.taskdefs.Sleep;
import org.openqa.selenium.internal.seleniumemulation.WaitForPageToLoad;
import com.thoughtworks.selenium.*;
public class small extends SeleneseTestCase {
public void setUp() throws Exception {
super.setUp("https://www.google.com", "*firefox");
}
public void testOpenGmail() throws Exception
{
selenium.windowMaximize();
selenium.open("/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1eic6yu9oa4y3&scc=1<mpl=default<mplcache=2");
pause(5000);
System.out.println("Open successfull");
// TODO Auto-generated method stub
String fieldIDs[] = selenium.getAllFields();
System.out.println("# buttons " + fieldIDs.length);
for(int j =0; j {
System.out.println("id = " + fieldIDs[j]);
System.out.println("value = " + selenium.getValue(fieldIDs[j]));
}
}
public void tearDown() throws Exception
{
super.tearDown();
}
}
P.S: the empty value is Ok. since there is no value of that id. Waiting guys, thanks again...
I am writing this piece of code to get the ids of the input fields on the page:
String buttons[] = selenium.getAllFields();
System.out.println("# buttons " + buttons.length);
for(int j =0; j
System.out.println("id = " + buttons[j]);
System.out.println("value = " + selenium.getValue(buttons[j]));
}
And the page is log on page of gmail, there are 2 input fields: Email and password yet the function getAllFields() just returns the Email field. And the length is always 1. I also tried the getAllButtons() and getAllWindows() function but nothing changes. Length is still 1 altough there are more than 1 fields. can anybody help me? Thank you.
I am using Eclipse Helios and Junit3 tests. Platform is windows xp professional. And here is the full code and the output:
package com.example.tests;
import org.apache.tools.ant.taskdefs.Sleep;
import org.openqa.selenium.internal.seleniumemulation.WaitForPageToLoad;
import com.thoughtworks.selenium.*;
public class small extends SeleneseTestCase {
public void setUp() throws Exception {
super.setUp("https://www.google.com", "*firefox");
}
public void testOpenGmail() throws Exception
{
selenium.windowMaximize();
selenium.open("/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1eic6yu9oa4y3&scc=1<mpl=default<mplcache=2");
pause(5000);
System.out.println("Open successfull");
// TODO Auto-generated method stub
String fieldIDs[] = selenium.getAllFields();
System.out.println("# buttons " + fieldIDs.length);
for(int j =0; j
System.out.println("id = " + fieldIDs[j]);
System.out.println("value = " + selenium.getValue(fieldIDs[j]));
}
}
public void tearDown() throws Exception
{
super.tearDown();
}
}
P.S: the empty value is Ok. since there is no value of that id. Waiting guys, thanks again...
Re: getAllFields() function returns only one element always, help!
Fri Jan 28, 2011 8:15 pm
hi,
storeAllFields(variableName)
Returns the IDs of all input fields on the page.
If a given field has no ID, it will appear as "" in this array.
check if both the elements/field have assigned some id to it. Otherwise it'll return only number of elements which have id.
Best of luck
storeAllFields(variableName)
Returns the IDs of all input fields on the page.
If a given field has no ID, it will appear as "" in this array.
check if both the elements/field have assigned some id to it. Otherwise it'll return only number of elements which have id.
Best of luck
Permissions in this forum:
You cannot reply to topics in this forum