Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

» Selenium IDE Verify different Maps (Hybridview, Mapview etc.)
Fri Nov 25, 2016 9:56 pm by DJ87

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

text input very flaky on Chromedriver

View previous topic View next topic Go down

text input very flaky on Chromedriver

Post by thegoatboy on 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.

thegoatboy

Posts : 3
Join date : 2012-07-03

Back to top Go down

Re: text input very flaky on Chromedriver

Post by iautomate on 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.

iautomate

Posts : 8
Join date : 2012-06-06
Location : Bengaluru

Back to top Go down

Re: text input very flaky on Chromedriver

Post by thegoatboy on 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?

thegoatboy

Posts : 3
Join date : 2012-07-03

Back to top Go down

Re: text input very flaky on Chromedriver

Post by iautomate on 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.

iautomate

Posts : 8
Join date : 2012-06-06
Location : Bengaluru

Back to top Go down

Re: text input very flaky on Chromedriver

Post by thegoatboy on 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.

thegoatboy

Posts : 3
Join date : 2012-07-03

Back to top Go down

Re: text input very flaky on Chromedriver

Post by iautomate on 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.

iautomate

Posts : 8
Join date : 2012-06-06
Location : Bengaluru

Back to top Go down

Re: text input very flaky on Chromedriver

Post by Sponsored content Today at 1:18 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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