I am using Watin to test a website. It contains a div which is created dynamically on clicking a tablecell. How can I access the dynamically created div. The issue is the div is deleted after a short span of time (even before the control can move to next line)

tablecell.ClickNoWait(); //this creates the dynamic <div>
if(div.exists) //the control does not go inside 
//code to edit div contents.
  • Could you update your post with the HTML/JavaScript referencing the div? The way you access it will depend on how the div is coded. – Kate Paulk Mar 6 '14 at 12:05
  • <div class="somevalue" style="somevalue"> <input type="text" value="" name="somevalue" id="processing"> </div> the <div> element is created after clicking a tablecell and is destroyed immediately if we click or do anything anywhere else. – Adwait Mar 7 '14 at 4:20
  • Can you please edit the question, as well as giving the HTML around the div and the javascript that "creates" the div element? There's a difference between the div contents being generated dynamically in response to an event through javascript and the contents being made visible in response to an event. – Kate Paulk Mar 10 '14 at 11:22
  • Thank you for reply, but the problem has been solved. – Adwait Mar 12 '14 at 4:36
  • In that case, could you answer your question with the solution you found and mark it as answered? That will help others who have the same problem. – Kate Paulk Mar 12 '14 at 11:06

I used threading. I put the main thread to sleep. and then started the child thread which was responsible for handling the textbox


child_thread contains code for editing the textbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.