Firefox returned “Your connection is not secure” Error code: SEC_ERROR_UNKNOWN_ISSUER for https connections. What now?!

Call IT, that’s what. That did not help.

Every https page I was trying to access had the same issue and would not load : Error code: SEC_ERROR_UNKNOWN_ISSUER

This has happened to me at least five times and it’s always the same. I had Fiddler running !!!!!!!!!!!!!!! It was intercepting Firefox traffic and my https connections were reporting invalid certs. So, I closed Fiddler and it was fine then.

Using while statement to check visibility or display CSS property (Selenium Python)

It happens often that your page is not predictable regarding when a certain element will become visible (ie modal).
This method has proven quite reliable in my tests. Loop through every second (or another time interval) until the element becomes visible:

while "hidden" in self.driver.find_element_by_id("ModalDialog").value_of_css_property("visibility"):
             time.sleep(1)

If it never becomes visible, well then your test will never end. That’s job security.
Similar method can be used for the display property.
Learn more about display and visibility over at w3schools (http://www.w3schools.com/css/css_display_visibility.asp).

Python Selenium – Simple manipulation with disabled elements and .is_enabled()

This one I researched when I had a page to test that had Previous/Next pagination buttons disabled if less than a certain number of rows were shown.

It went something like this:

if self.driver.find_element_by_id(TheMostAwesomeReport.nextButton).is_enabled():
    #Test pagination scenario
else:
    #pass or continue, or some other check here

This was for an input element that did have the disabled attribute:

disabled="disabled"

Definitely helpful.

Trying out Atom text editor

Download Atom here.

I have been trying it out in the past few days and it looks really good. Brings together the features I use from Notepad++ and Sublime.

I have installed multiple packages like json formatting, lint, xml formatting, sublime style columns, script, minimap and it works really well. I like having the find/replace at the bottom of the UI (like in Sublime). Had one issue with Regex though it might be user error.

Dark themes are easy to set up. No complaints so far. I will play a bit more with remote editing, and other packages to make the final call.

freetds not able to connect to MSSQL DB from Linux (Ubuntu)

There were two things preventing me from connecting:
– I did not have the correct port. Found this using: tsql -LH IPAddress
– Then I was stuck. Finally found the post below. You have to have a freetds config file in the home directory. Somthing like this:


awesomeserver:~$ less .freetds.conf
[global]
    # TDS protocol version
    tds version = 7.0

helped by:
http://stackoverflow.com/questions/7590944/freetds-connection-problems-on-linux?answertab=active#tab-top

Nosetests changes my sys.path. There is a flag to disable this.

Per the ever useful documentation from http://nose.readthedocs.org/en/latest/usage.html:

-P, –no-path-adjustment
Don’t make any changes to sys.path when loading tests [NOSE_NOPATH]

Tests were written with PyCharm. If I just executed the Python script with “python my_script_test.py” it worked well. If I however used nosetests like this “nosetests my_script_test.py” it would not work as I used sys.path in one of the configuration parameters. So this worked:

nosetests -P my_script_test.py

XPATH selection with node text content. Super useful. Python Selenium.

Not sure how I missed this selection method. It’s one of the most useful methods of selecting an element. By its text. So if you have something like :

<span class="important text">Hello There</span>

The xpath for this element could be :

//span[@class='important text' and text()='Hello There']

In the code this could be something like:

self.driver.find_element_by_xpath(Locators.HelloThere).click()

The text element, I believe, is good as even if the backend code changes there is less likelihood of front end text changing and confusing the end user. The test has more staying power.

Selenium Python – Selecting and focusing on the correct frame or iframe

Had an issue today where a modal opened up on the site, but I was not able to click anything inside it. After digging through the source realized that it was in an iframe. It was the only iframe in the page so the xpath element to find it was simple, just “//iframe” . To focus on this iframe used code like this:

frame_modal = self.driver.find_element_by_xpath("//iframe")
        self.driver.switch_to_frame(frame_modal)

Following some actions inside the iframe, I had to now return to the main page. This is what did it:

self.driver.switch_to_default_content()

I was now back on my main page able to continue the test. Took me a while to figure this out so posting here as it might help someone else.