0

I am new learner of selenium. I am working an application to automate few of it's scenario's. Am facing a problem in a scenario where I need to wait for an element until along with it's data to be loaded.

Problem: The problem here is the element is loading first and some how it's refreshing again. If any element has it's default value to be displayed the value will displaying after some milliseconds of time. I meant to say element is displaying first and data binding of that element is after sometime.

As I knew that the WebDriver will waiting for an element to be displayed on the DOM but not until data to be loaded. So, when am inserting some text into any input field it's refreshing with its default values again then the text entered is clearing.

My question is how to wait for an element along with it's data to be loaded on the page.?

srinivas
  • 1
  • 4
  • possible duplicate of [How can I ask the Selenium-WebDriver to wait for few seconds?](http://stackoverflow.com/questions/12858972/how-can-i-ask-the-selenium-webdriver-to-wait-for-few-seconds) And [here](https://stackoverflow.com/questions/2835179/how-to-get-selenium-to-wait-for-ajax-response), and [here](https://stackoverflow.com/questions/7991522/selenium-webdriver-test-if-element-is-present). And a whole bunch of other questions I'm not going to link to right now. Stack Overflow has a neat search feature which allows searching for questions. – Louis Mar 20 '14 at 09:12
  • If the duplicates don't answer your problem, then you need to edit your question to explain more precisely your situation. – Louis Mar 20 '14 at 09:16

1 Answers1

0

You can try the below:

new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("xpath of your element"))).click();

Shyamala
  • 69
  • 4
  • 6
  • 13
  • The above one is will not work in my case. Please read my question once again. In my application all elements on the page is displaying properly, but the default values of the elements will be displaying in a fraction of seconds later. – srinivas Mar 20 '14 at 17:50
  • Ex: Lets take an input field, I want to enter some text into it. So, when the webdriver find this element on the page driver started inserting the text into the input field, but later time the default value of the input field is binding to the input element and clearing the text inserted. – srinivas Mar 20 '14 at 17:57