June 13, 2016

Handling OnChange events using Selenium webdriver and Java script

In this post I will discuss about onchange events.

What is onchange event?
The onchange event occurs when the value of an element has been changed.
For radiobuttons and checkboxes, the onchange event occurs when the checked state has been changed.

onChange specifies script code to run when the data in the input field changes. The onChange event is triggered when the contents of the field changes.

In this example if you type some thing in Quantity filed and click on anywhere on the page it will automatically update Total.








We can handle onchange events in different ways.

1. After entering quantity we can simulate clicking TAB button. But this is approach will not work always.

2. By using Java script we can trigger onchange event.


Using Java script to trigger onchange event...


((JavascriptExecutor)driver).executeScript("arguments[0].onchange()", driver.findElement(By.name("vn_qty")));

Below is the sample script.










53 comments:

  1. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it. What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity..

    Digital marketing company in Chennai

    ReplyDelete
  2. Such a great articles in my carrier, It's wonderful commands like easiest understand words of knowledge in information's.

    ccna training in chennai Adyar

    ReplyDelete
  3. Thank you for your post. This was really an appreciating one. You done a good job. Keep on blogging like this unique information with us.

    Best Seo Services in Chennai

    ReplyDelete
  4. Nice article about Handling OnChange events using Selenium webdriver and Java script.People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get Online selenium training in chennai

    ReplyDelete
  5. I learnt how to use selenium web driver & java script.So now it was easy to handle.It was easy to understand me.Thank for sharing that useful information.Keep in blogging.. Selenium Training in Chennai
    Hadoop Training in Chennai
    Dot Net Training in Chennai
    Android Training in Chennai

    ReplyDelete
  6. Dear, I like all your post. Everything looks so sweet, I admire this kind of life and the best wishes for you. Hope that we can communicate with each other. By the way, anybody want to boost app ranking ? This one is useful.

    ReplyDelete
  7. Amazing & Great informative blog,it gives very useful practical information to developer like me. Besides that Wisen has established as Best Java Online Training from India . or learn thru Online Training mode Hibernate Online Training . Nowadays Hibernate ORM has tons of job opportunities on various vertical industry. or learn thru JavaScript Online Training from India. Nowadays even JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete
  8. Hats off to your presence of mind..I really enjoyed reading your blog. I really appreciate your information which you shared with us.
    ME/M.Tech Project Center in Chennai | ME/M.Tech Project Center in Velachery

    ReplyDelete
  9. Very happy to see this blog. Gives a wonderful information with coded explanaion. Thank you for this blog. very useful to me.
    Java Training Center in Chennai | Best J2EE Training Center in Chennai | No.1 Java Training Institution in Velachery | Core Java Training in Chennai

    ReplyDelete
  10. It is really amazing...Thanks for sharing....Provide more useful information..Embedded Project Center in Chennai | Embedded Project Center in Velachery

    ReplyDelete
  11. I found some useful information in your blog.Thanks for sharing such a wonderful article...
    Best Mobile Computing Project Center in Chennai | Mobile Computing Project Center in Velachery

    ReplyDelete
  12. I have found a lot of interesting information here. It is really a good post.
    IEEE Project Center in Chennai | IEEE Project Center in Velachery

    ReplyDelete
  13. Well Said, you have provided the right info that will be beneficial to somebody at all time. Thanks for sharing your valuable Ideas to our vision. Keep it up. Business Administration Summer Camp in Velachery | Business Administration Summer Classes in Chennai | Business Administration Summer courses in Taramani

    ReplyDelete
  14. Amazing Article, thank you!. I am very glad to read your informative & practical blog. Kindly keep updating your blog.
    Excellent Summer Courses for Business Administration in Chennai | Perfect Summer Courses in Guindy

    ReplyDelete
  15. Great post! I am actually getting ready to across this information, It's very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well..
    Summer Training for Graphic Designing in Chennai | Summer Training for Graphic Designing in Velachery

    ReplyDelete
  16. Truly a very good article on how to handle the future technology,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic.
    Good Summer Courses for Hardware and Networking in Chennai | Perfect Vacation Courses in Chennai

    ReplyDelete
  17. It is most knowledgeable information like this.I will read this article it is very easy to learn this blog.
    Summer Camp for Kids in Chennai | Summer courses in Shozhinganallur | Summer classes in Chennai

    ReplyDelete
  18. Nice post... Really you are done a wonderful job. Thanks for sharing such wonderful information with us. Please keep on updating... Summer Camp for Computer Science in Velachery | Summer classes for Computer Science in Chennai | Summer Courses for Computer Science in Taramani

    ReplyDelete
  19. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Summer Courses for Android in Perungudi | Summer Courses for IOS in Velachery | Summer Courses in OMR

    ReplyDelete
  20. Awesome list, just starting a blog and this is going to be a massive help. Thank you!
    Best Multimedia Vacation Course in Chennai | No.1 Summer Courses in Porur

    ReplyDelete
  21. Impressive blog with lovely information. really very useful article for us thanks for sharing such a wonderful blog... 
    Summer Courses in Perungudi | Summer Courses in OMR | Summer Courses in Velachery

    ReplyDelete
  22. Really its a very good article, thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic. Graphic Designing Summer Courses in Velachery | Graphic Designing Summer Courses in Chennai | Graphic Designing Summer Courses in Taramani

    ReplyDelete
  23. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
    Software Testing Summer Courses in Adyar | Summer Courses in Velachery | Java Summer Courses in Perungudi

    ReplyDelete
  24. Thanks for this grateful information. all this information is very important to all the users and can be used good at all this process.
    Selenium Summer Courses in Velachery | Web designing summer Classes in Adyar | Android summer Courses in OMR

    ReplyDelete
  25. Great blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.
    ISTQB Certification Training in Chennai | Java Exam Center in Chennai | Microsoft Dot net Certification in Chennai

    ReplyDelete
  26. Great Blog... The information you shared is very effective for learners I have got some important suggestions from it, Keep Sharing such a nice blog.
    UIPath Exam Center in Chennai | Automation Anywhere Exam Center in Chennai | Blue Prism Exam Center in Chennai

    ReplyDelete
  27. Nice post... Really you are done a wonderful job. Thanks for sharing such wonderful information with us. Please keep on updating..
    Cisco CCNA Certification Center in Chennai | Best Cisco Center in Guindy

    ReplyDelete
  28. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing... Python Certification Training Institute in Chennai | Best Python Center in Taramani

    ReplyDelete