Selenium import into Ignition 8.1.13

Hello,

I am trying to install Selenium into Igntion version 8.1.13 and I am constantly getting error from just doing from selenium import webdriver…

I have tried Selenium 3.141, 3.4.1, 3.0.2 and I get differents errors mostly with the remote_connection.py (webdriver/remote folder) linked to import urllib

My goal with Selenium is to get information from a HTML page that needs JavaScript scripts to execute before analysing the HTML source.

Thanks!

I think you might be going down the wrong path here. Selenium is typically used to interact with already rendered webpages (interacting with pages before they are rendered is a good way to run into StaleElementReferenceExceptions). As you have control over all the data Ignition would be rendering in Perspective with the ability to tweak it via scripting transforms, I don’t understand how Selenium would provide a benefit.

That being said, Selenium 3 (and 4) for Python would require Python 3.5 and above. As Ignition uses Jython, which uses Python 2.7, it would not meet the minimum required version for installation.

Thanks,
Garth

1 Like

Hello,

I am not using Perspective to generate this and it would be executed in dedicated thread on a timer basic.

The goal is to poll some printer who’s OPC service is not 100% reliable, but by browsing it’s web interface, I can get the field that I need after the page finish loading it’s javascript.

I am asking here because I have seen some polls in the forum with this python module.
Can HttpClient method or HttpGet ( system.net.httpClient - Ignition User Manual 8.0 - Ignition Documentation (inductiveautomation.com)) help me resolve my issue?

If you look at the browser dev-tools when the OPC service web interface is loaded, is there an API that you might be able to leverage that would return the data you are expecting? HttpClient and HttpGet will not get the rendered JavaScript, so you likely won’t get the information you are looking for. If there is an API that returns JSON or XML, you could call the API from Ignition and make decisions based on that. It would also be a lot quicker than scraping a webpage if it is an option.

Thanks for the quick answers!
It does not look like there is any API behind, at least from what I see. The printers are VideoJet 3640.
When loading the page, I can see that it is passing some kind of random ID as parameter (http://…/?wtd=RandomId&…&…&rand=RandomStuff), but I cannot see any pattern.

I have searched for other solution (requests_html, requests, etc…), but most of them are not compatible with jython 2.7.

Any other ideas?

Have you tried SNMP ? It is far more common on IT-ish devices.

Good idea! Sadly it does not support it.

It would be a real hack job, but have a selenium script outside of Ignition running periodically (via a cronjob or similar) that writes expected output to a file. You could then use Ignition to read in that file via a Gateway Event script and process out the result.

Garth

1 Like

Thanks Garth.

My goal was to use Ignition as much as possible, I have created a C# application that stores the result in a database. Next goal is to get the last row from Ignition and send this to a PLC tag.

I will mark this as completed! Thanks for your help!

1 Like

I'm looking at doing something like this. Had a windows scheduled task running python 3.7 script, loading selenium, and writing the results to a local DB. I saw another post with the suggestion of exposing OPC-UA providers then having the external client connect to Ignition tags via OPC-UA. Going to try this way as then I can then historize the tag and pull into perspective.

FYI below on Selenium, it gives information like below -- nice to monitoring our MES and if things start acting up it's easy to tell which part of the site is struggling