Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
thegoatboy
Posts : 4
Join date : 2012-07-03

text input very flaky on Chromedriver Empty text input very flaky on Chromedriver

Tue Jul 03, 2012 8:14 pm
Hello all,

I am very new to using chrome driver, so please if you can offer assitance i would be very grateful.

I am trying to fill in some text input on a web based application.

I can navigate to the page I need, but the text input really doesn't seem to work correctly using webdriver.

I will break down my code here:

Code:


WebElement firstName;
WebElement surName;

...

String firstNamePath = "//input[contains(@id,'txtFirstName')]";
String surNamePath = "//input[contains(@id,'txtSurname')]";   

firstName = driver.findElement(By.xpath(firstNamePath));
firstName.sendKeys("Barry");
       
surName = driver.findElement(By.xpath(surNamePath));
surName.sendKeys("Parry");     


My issue is that the first name is added correctly (Barry in this case) but the input of the second name fails 99.99% of the time.

I've tried adding some Thread.sleep bits in and many other ideas but this always fails.

I've tried adding a driver.click() for the surname element, but again this also fails, unless I add around 2 -5 just to get it to choose the correct element.

Can anyone offer some assistance in what I can do to get a reliable text entry using the Webdriver?

I don't understad how some basic functionallity like this doesn't work in chromedriver.

Is there some way I can keep checking until the correct text has been inputted?

or do i need some kind of wait command before continuing?

I am using Windows XP as well as eclipse.
avatar
iautomate
Posts : 8
Join date : 2012-06-06
Location : Bengaluru

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Wed Jul 04, 2012 11:24 am
Hi.

I tried similar to what you have tried on the yahoomail website using the chromedriver and it works perfectly fine everytime. My code is as below

public class yahoomail{

public static void main(String args[]) throws InterruptedException{

WebElement Emailid;
WebElement Password;

WebDriver wd = new ChromeDriver();
wd.get("http://www.yahoomail.com");

Emailid = wd.findElement(By.id("username"));
System.out.println(Emailid.getTagName());
Emailid.sendKeys("hello");

Thread.sleep(100);

Password = wd.findElement(By.id("passwd"));
System.out.println(Password.getTagName());
Password.sendKeys("abcd");

Thread.sleep(100);

wd.close();

}

I am not sure why its going wrong in your case , i only suspect that identifying the webelement is failing can you try accessing the webelement using its id or the classname instead of xpath and check whether its consistent.
avatar
thegoatboy
Posts : 4
Join date : 2012-07-03

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Wed Jul 04, 2012 3:23 pm
It seems that it is down to the speed of the applicaiton running.

I can get it to work correctly by sending

surName.click();
Thread.sleep(600);
surName.click();
thread.sleep(600);

This works.

For example, the first click() does not always select the second box, so I had to click twice to get this to work.

If this wasn't included, it seemed the application would just plough through too quickly, and in my case, I am also adding DOB info for instance, and this info would be placed in the worng boxes.

it seemed that there wasn't just enough time to complete the data.

There may be some hidden script working in the background of the application I am testing, so the text input may be just too quick for webdriver when switching to new web elements.

does that make sense?
avatar
iautomate
Posts : 8
Join date : 2012-06-06
Location : Bengaluru

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Wed Jul 04, 2012 3:48 pm
I think its not a good strategy to add redundant statements like above and make it work , its not a clean solution. I think you need to root cause what exactly is going on and implement a reliable solution. This solution for me looks very unstable.
avatar
thegoatboy
Posts : 4
Join date : 2012-07-03

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Wed Jul 04, 2012 4:06 pm
I know what you mean

but at the moment I have no idea what's wrong.

I've seen other posts on the internet with the same issue, but no reliable solution.
avatar
iautomate
Posts : 8
Join date : 2012-06-06
Location : Bengaluru

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Wed Jul 04, 2012 4:12 pm
For the time being you can go with this workaround but once you figure out the problem do post it here.
Sponsored content

text input very flaky on Chromedriver Empty Re: text input very flaky on Chromedriver

Back to top
Permissions in this forum:
You cannot reply to topics in this forum