Selenium - Python. Works but fails

script
ghpython
python

#1

Hi, lately I been writing some basic scripts for using selenium in grasshopper, I have tried with, (ghpython, Cpython, and python remote) but they all seem to break at some point. And I’m running out of ideas, so I was wondering if anyone has any advice or have tried this before.

This are the 3 approaches I have tried:

  1. Cpython: Everything works except when you run the script, so, the module loads, (selenium, selenium.webdriver…), but when you run the script rhino breaks and stops working but it loads the web browser.
  2. Python-Remote: the selenium library loads in the GHPythonRemote component, but I don’t know how to import the – webdriver– class from selenium module. I don’t really know if if it is posible to specified the – import selenium.webdriver– with this approach and I couldn’t find any example on how to import classes from modules using Python-Remote
  3. ghpython: I tried using the subprocess module to run a python script from the cmd, I belief this method works, but I wasn’t able to keep the process running, the process starts, a black window appears and very quickly it close, and the browser never starts.

The reason why Im trying to use selenium is for reading javascript from a website, if you know any other way of achieving this please comment on it. Thanks.

I have attached an examples for every case, and the python script I’m using for the ghpython case.
Selenium_Examples.gh (9.6 KB)
FTS.py (406 Bytes)