DEV Community

Arlene Andrews
Arlene Andrews

Posted on • Originally published at distort-roving.blogspot.com on

Testing: ElementalSelenium's 5 days of frustrations and explorations


https://www.velior.ru/wp-content/uploads/2009/05/Test-Computer-Key-by-Stuart-Miles.jpg

After many months of trying things out, and finding what I was and was not good at, I have found an interest that I would like to follow: testing. There are so many new things coming out, and with the connected devices that we are starting to see, plus the possibility of problems coming from sources we think are trustworthy - this sounds like a career that I can enjoy, be good at, and grow into.

For those of you who have read my earlier writings, this may sound odd - I've been grumbling about the lack of education for testing in the publicly available courses nearly since this blog started. But, as several have pointed out (occasionally bluntly), if there is a need that isn't filled, what's stopping me from filling it?

So now it's time to move forward, and contribute to having information that I've found useful.

I had a generous someone point me towards ElementalSelenium, once I mentioned that I would like to explore this as a career. Not only does this site provide testing tips (if you work in Selenium, you may enjoy these, and the archive is open), but they offered a free class to let you see exactly what it does, and how.

Yes! This particular group knows that I enjoy the shorter classes, and what the budget for learning resources is (i.e. none), so of course I signed up for this immediately. I had been working on a learning project, and wasn't sure how to test some of the pages- and this seemed like the perfect, easy answer. They offer a selection of languages, which made it even better: my app is Python, so I'm choosing that. There's a virtual environment set up already - might as well make good habits.

And just two things to install? This is even better - I can get set up, and ready to go promptly.

After a bit of introduction, and tips on finding elements to test for (and making notes to go back and add these into my app : blush : ) the first test is written, and ready to go. Of course I'm going to run this! And an error pops up - nothing too unusual: the day had been filled with typos, even on something as familiar as my own name, or the word the. Since, in order to develop the muscle memory to get these in, I had manually typed this test in. I fixed the obvious error, and went on with the class.

This seemed to fit, and will be great to test my app - I was looking forward to the end of the lesson, and getting around to writing my own tests.

And it fails, again.

And this one I don't know what to do with - the browser shows up, but it says it can't find the profile?

Okay, this is learning time, for certain. Time to find out what might be causing the issue. I guess testing to figure out the errors on a testing platform is part of the learning. I'm still happy enough that even if it is technically time to stop for the day, I'm going to continue.

It seems this is common - I don't feel as bad: there's likely several solutions, so I can narrow down where my error is, and know why it happened. As fast as things are changing, my first guess is it's an update to something in the system, or maybe a minor version correction moved a reference.

After looking for a while, I find that, maybe the answer is I need a framework - and there's a selection of them. Start the download/install, and call it a night - this should make it work in the morning!

I also found the Gekodriver (which needed to go in the bin folder of the virtual envelope, and the main Python folder in Windows - this was an issue for a few panicked moments)- this at least is giving me a different error! And a lesson in how long it had been since I installed a tar file

More durable tests? Yes PLEASE! Oh I so want this to work. A fresh cup of tea, and back into research. Even if my typing is passing muster today, I want my tests to work, darn it!

Okay, this one seems straightforward: the answer to a Stack Overflow question. Yes, this looks like my problem - read the answers, and find one by Dharma-krish : pointing out some obvious things. If you have the newest Firefox, use the newest Selenium driver. Okay, that will help - and is obvious. And above this is the way to set a Firefox profile (5 lines instead of 1 - I will take it!)

fp = webdriver.FirefoxProfile()

(Here "2" stands for "Automatic Proxy Configuration")

fp.set_preference("network.proxy.type", 2)

fp.set_preference("network.proxy.autoconfig_url", "http://proxy-address-here:8080/")

driver_ = webdriver.Firefox(firefox_profile=fp)

A deep breath, and trying it on Day 2's code ... it loads, and finds a profile (!) , and the test passes!

Since I have the next day's code up and ready to go, a bit of copy and paste gets the new changes in, and Day 4's code done, and passing. After a few bad starts in making sure files got to their correct places, I now have the code working in both Ubuntu and Windows.

If you have this issue, at least until the next update, this may help you.

  • Make sure you have a testing framework installed
  • Use the newest version of all the programs
  • For now, make sure Gekodriver is in the PATH (bin folder of the virtual envelope, and the main Python folder in Windows )
  • Set your Firefox profile as above - you can modify it further if needed
  • And have fun!

Day 5's class seems to be on setting up for multiple browsers - I'm going to celebrate having it work in one for the moment.

Top comments (0)