Tuesday, August 16, 2016

AUTOMATION 23 - GUI 10, Switching to Chrome

Technical difficulty: ****

Last week I reported on the recent changes to Selenium WebDriver.  Specifically they impacted using Firefox out-of-the-box, meaning you needed to download an position a new driver to make it work.

I was hoping it'd be all sorted by today - but alas no.  Although generally good, I'm getting issues on some basics - to confirm it's the new Gecko driver, I've tried running on Chrome, and found the issues vanish.

Update Selenium WebDriver in your project area

Switching to Chrome is relatively easy - but first we need to update our version of WebDriver used in our project.  Start with downloading the latest version of Selenium Webdriver here, and extracting it to somewhere on your system (remember where).

Under Eclipse, I've gone into my project gone Build Path -> Configure Build Path


There I've removed the previous .jar files for the last Selenium WebDriver build I've done, and then used Add External Jars to add back in all the new ones.




Put the browser driver into place

The Google Chrome driver (and indeed the Gecko driver) are a form of middleware which acts between the software of the Selenium WebDriver and the browser itself.  You'll sometimes hear the word "marionette" used to describe it, because this software essentially "pulls the strings" on your target browser.

Now, you need to download the Google Chrome Driver from here,


Now a little more tricky - to make this work it needs to be copied into your project workspace, for me it goes ...


You might notice I've also placed a version of the Firefox Gecko driver there as well.



Change your code

This is really simple - first off in your header you need to include the following,

    import org.openqa.selenium.chrome.ChromeDriver;

This includes the objects and methods needed for the ChromeDriver.  You then change your declaration of,

    WebDriver driver = new FirefoxDriver();

To ...

    WebDriver driver = new ChromeDriver();

That's pretty much it.  Although in reality there can be oddities thrown out by a change of browser - I found mine regarding the selection of frame which contains "Enter your comment".  I modified my code to use an algorithm which looked through all the frames on the page, selecting the one which says "Enter your comment" ...



I've already committed these changes to my Github page - find me there.  Really it's the second project which has had the most revision to include that frame search, which is here.

31 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. I am glad to see this post on your website. It is beneficial for us and can be very useful in our daily life, and we always use your website information and experiences. Anyway, thank you so much.
    digital marketing services in india

    ReplyDelete
  3. Nutra Trials defines personal characteristics of different health products including skincare, weight loss, muscle and male enhancement. The study presented here is briefly described for reader convenience and to deliver them assurance with health standards. The best possible answers are given here regarding the selection of an ideal supplement or cream or serum that possibly remains to be safe for health and do not cause any side effects.

    ReplyDelete
  4. It is a great job, I like your posts and wish you all the best. and I hope you continue this job well.
    NutraT line

    ReplyDelete
  5. Enduro stack Testosterone Booster is much safer than taking steroids or random supplements from the drugstore. Because, those supplements aren’t quality controlled or checked for safety, unlike this one. And, the majority of these products rely on artificial ingredients, fillers, and binders. Overtime, artificial ingredients can harm your body by building up toxins in it. Now, you can avoid that situation altogether with Enduro stack. Because, this supplement is completely natural, and it boosts testosterone the safe way. So, you can finally get results without worrying about hurting your body. Click below to order your own Enduro stack free trial!
    Enduro Stack

    ReplyDelete
  6. Hello, I am thomus jons thank you for this informative post. That is a great job. Wish you more success.Thank you so much and for you all the best. Takes Down
    123movies

    ReplyDelete
  7. TecSmash is your ultimate source of Technology news and Make Money Online product reviews. We research and review all Tech, MMO, Biz Opp and IM products.
    Tecsmash

    ReplyDelete
  8. Best softwares for Internet Marketers and legitimate make money online opportunities.
    cxyrc

    ReplyDelete
  9. Here is our FB SociCake Review, in which I have revealed the good, bad and ugly about Mario Browns FB SociCake Facebook Marketing Tool. socicake review

    ReplyDelete
  10. We are here to give you a complete review on the Parallel Profit project by Steve Clayton and Aidan Booth. If you are someone from the field you would already be familiar with these two names, for those of who are new. Parallel Profits Review

    ReplyDelete
  11. Best softwares for Internet Marketers and legitimate make money online opportunities.
    cxyrc

    ReplyDelete
  12. WiredReach.org is dedicated to bring you the best in Internet Marketing, Blogging and the entire Make Money Online spectrum. We are your finest source of info.

    ReplyDelete
  13. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work…
    Weight loss foods
    SEO
    hack

    ReplyDelete
  14. Quit 9 To 5 Academy Review is an amazing website where you get to work and learn with the professionals and then start your business in the platform of Facebook.

    ReplyDelete
  15. Eat Stop Eat Book program was one of the foremost and is not actually counted as one of the fads. It is your crucial guide but using the latest science for intermittent fasting to attain simple yet effective weight loss results.

    ReplyDelete
  16. The Probiotic supplement helps to balance good bacteria and in this regard, Probiotic t-50 review is creating buzz. How far is the supplement reliable and worth considering, you will come to know about it here.

    ReplyDelete
  17. Don't Waste Time! 5 Facts Until You Reach Your Adtrics Academy - https://www.reviewengin.com/adtrics-academy-review/

    ReplyDelete
  18. Keto Ignite Diet is one of the best dietary supplements that is dedicated to shed pounds and drive instant weight loss reduction naturally. It is a dual action appetite suppressant that works on the ketosis process and controls the carbohydrate conversion to fat structure and drives energy and strength level. Kindly Visit on http://www.rushyourtrial.com/coupon/keto-ignite-reviews-ketosis-weight-loss-pills/

    ReplyDelete
  19. Keto Buzz is a weight reduction formula which is used by a variety of different customer for the different desires. This supplement has the capacity to enable ketosis in your system, due to which you will be able to reduce fat faster. In addition to this, it also promotes other health benefits, making you less prone to heart risk, and cholesterol diseases. Visit On http://www.powerenrich.com/keto-buzz-weight-loss-supplement-reviews/

    ReplyDelete
  20. Very nice post, I visited your blog for the first time and became your fan.
    https://www.drozus.com

    ReplyDelete
  21. Thanks for sharing this useful information! I am very happy to read this article
    https://www.drozus.com

    ReplyDelete
  22. Informative article, exactly what I wanted to find.               
    https://www.drozus.com

    ReplyDelete
  23. Post very nicely written, and it contains useful facts. I am happy to find your distinguished way of writing the post               
    https://www.drozus.com

    ReplyDelete
  24. TimesForEducation.com - Everyday News Portal Of Education

    TimesForEducation
    https://timesforeducation.com/

    TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ===========================================================

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    normal comment. TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/


    ReplyDelete
  25. Wow! This is really well organized! I like finding Information in categories like this.Absolutely love your creative idea! Can I share your post on my facebook page?

    Keto BodyTone

    ReplyDelete
  26. For most up-to-date news you have to go to see web and on the web I found this website as a finest website for latest updates.               
    https://www.drozus.com

    ReplyDelete
  27. Thanks for share this valuable post TimesForEducation. We Regularly Update Education's News From All Over The Worlds. Our Mission Not Only Provide Education's News But Also People Get Become Educated. Visit also this website: https://timesforeducation.com/

    ReplyDelete
  28. A popular and trusted product which can help you with Psoriasis is the Psoriasis Strategy book. This product has helped a number of people and it effectively makes the condition better day by day. So let’s have a look at the popular Psoriasis Strategy Review in the System Agility blog.

    ReplyDelete
  29. I usually commit those mistakes especially when in front of the computer where I don’t really think of anything else but what’s on the screen.thnx
    Morgan @ Gowell Health Tips

    ReplyDelete
  30. This Mend The Marriage review is meant to throw light on the overall effectiveness of this product. Man behind Mend The Marriage book is Brad Browning.

    ReplyDelete
  31. Thenutritionsclinic This is one form of service you will now not need to live with out. If you do not, you could discover your self managing some harsh health troubles in later years. Bone density troubles arise with growing old as your bones lose calcium. Those makes them weaker, resulting in a condition known as osteoporosis or porous bones. Those weaker bones now are a good deal greater vulnerable to fractures, leaving you to try and keep away from any and all falls or bumps.
    https://thenutritionsclinic.com/

    ReplyDelete