Python Selenium chromedriver : StaleElementReferenceException: Message: stale element reference: element is not attached to the page document .. some notes

When switching to using chromedriver and away from PhantomJS these messages were everywhere. They are a bit misleading.

StaleElementReferenceException: Message: stale element reference: element is not attached to the page document

A lot of these can be fixed with waiting for the element to fully load before trying to access it. In the cases we ran into, almost all stale element references were due to javascript not fully loaded before the element could be accessed.

A simple time.sleep() would immediately fix it. Then we searched for more elegant ways to wait for the element.

The error message mentions stale element which one might associate with old and outdated, but in fact it’s actually too new.

Python Selenium Chrome driver : element is not clickable at point. Other element would receive the click (Solved)

This is a common issue with Chrome Driver. There are a bunch of discussion boards where requests are made to have this fixed but for some reasons Chrome developers are stubborn in not fixing it. How about they ask their customers what they would want!

Anyways, this helps. It moves the element into view. For a set of tests we had that worked fine with PhantomJS (too bad dev was discontinued) and Firefox, errors came up with Chrome. This was along the lines of : element is not clickable at point. Other element would receive the click.

Before the element that has that error, you could input this line (change the element please, unless you are clicking on Good Morning! text:

self.driver.execute_script("arguments[0].scrollIntoView();", self.driver.find_element_by_link_text('Good Morning!'))

That fixed it for us and did not break PhantomJS and/or Firefox compatibility.

HDD to SSD slow transfer using SATA to USB3 cable (somewhat solved)

As just about everyone else I am switching my hard drive to an SSD.
Purchased the Samsung 850 EVO 1TB 2.5-Inch SATA III Internal SSD (MZ-75E1T0B/AM). That all arrived well.
Also then bought a Sabrent cable, SATA to USB 3.0 (under $10).
The problems started occurring when I was cloning the drives using Samsung’s Data Migration Software.
Note : My existing drive (SATA II internal) has been showing errors when using various HD inspection tools so that is one possible cause of slowness. It was also becoming very slow during general operation which was the reason to switch to SSD.

  1. I was cloning approximately 670GB of data on 931TB drive
  2. On the initial attempt transfer rate was 1MB/s. The estimate was 300+ hours to complete so I aborted that.
  3. I then plugged the cable into the USB 2.0 port. That produces speeds around 25MB/s but still very slow
  4. Then I switched back to plugging it into the USB 3.0 port. This time, speeds got up to 59MB/s and the promised completion time was under 4 hours which is acceptable. However, half way through it slowed down to 1MB/s and I had to cancel.
  5. Following some online research I proceeded to: disable Microsoft real time virus protection, disconnected the network drives that were mounted and also disconnected the Ethernet cable from the PC completely diabling networking.
  6. That worked. Speeds were again near 60MB/s and the clone took under 3.5 hours. Success.

I do know that USB 3.0 should provide higher transfer rates, but at this point I was just happy to get this done. I did not have time to investigate more.

PyCharm 2017.3 causing issues when nosetests runs into errors (Python Selenium)

After upgrading to PyCharm 2017.3 I am not able to run my tests properly. Any time an error is encountered, the test case does not fail and move on, it just stops executing. Downgrading to PyCharm 2017.2.4 resolves the problem.

Here are the errors I get:", line 17, in

... etc etc etc .....

in formatError
ec, ev, tb = err
TypeError: 'NoneType' object is not iterable

Selenium Python configuration for Chrome in headless mode

Here is what worked for me related to Chrome in headless mode:

First import a few modules:

from selenium import webdriver
from import Options

Then set the driver:

chrome_options = Options()
chrome_options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
self.driver = webdriver.Chrome(executable_path="C:/webdriver/chromedriver.exe",chrome_options=chrome_options)

Please make sure to change the binary location to where Chrome is installed on your system. Also, you will need the latest chromedriver.exe executable (downloadable from here : You will need to put its location in the executable_path. You will need Selenium 3.8.0 approximately as well.

REST Client for Visual Studio Code is nice

Get it from the extension manager in VS Code: REST Client by Huachao Mao

GitHub fun is here:

I wanted to include some examples, but then I saw the documentation in VS Code for this extension and it’s very good. Just scroll through the Details tab and get the instructions how to use. It’s quite simple, including, something like GET for a simple get.

Selenium Python configuration for Firefox in headless mode

This worked for me :

Import few modules:

from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FFOptions

then set the driver:

options = FFOptions()
self.driver = webdriver.Firefox(firefox_options=options)

Please note that you have to have the latest FF (57 will do) and selenium 3.8.0 approximately.

Errors when starting Blender on Windows, related to PYTHONPATH : Solved

I needed to document this here as every new release I run into the same issue when starting Blender. It crashes on start. Found the solution on the net:

Create a batch file to start Blender. I named mine blender.bat (quite original).

Contents of the file :

cd C:\Program Files\Blender Foundation\Blender\
start blender.exe

Adjust your install location as needed. Then just save and double click to start. Voila!