How to use nuget packages in c# code stage

chm

New Member
Hi there smart RPA people.

I just wanted to know if you can use external nuget packages in the code stage in c#.

What I am trying to achieve is to use Selenium with Internet Explorer.
I downloaded the package and extracted dlls for .net framework 4.0 (one i have installed): https://www.nuget.org/packages/Selenium.WebDriver/

I added them to the Code Options in properties along with the namespaces:

dlls.PNG

Then I wrote the most simple code to initiate IE through webdriver:

code.PNG

But sadly i get exception. Webdriver cannot be loaded.

error.PNG

Has anyone succeeded in using external dlls for code stage?
Any tips would be highly appreciated.

Thank you and have a good day :)
 

bbastias

New Member
i had the same error message byt i was trying use the MAPIEX object, i think its a problem with the DLL´s version and BP's version
 

DFugere

New Member
Hi,

This is a late reply, if someone need in the futur.

I managed to make selenium work under blue prism. it does take some work...

First you need to be able to lunch dll from BP. For this there is no (good) work around, you need to drop the dll within BP folder. I think you should be able to use symlink and create a separate drive for the dll. But this need some investigation.

Second you need to be able to reattach a selenium webdriver to an existing IE browser. (one can follow https://tarunlalwani.com/post/reusing-existing-browser-session-selenium-csharp/ ) This one is a litle bit tricker, but work good.

Third, if you want to reattach your selenium driver, your original driver has to still be running, it means you cant open it in blue prism, as the variable die as soon as the code stage has ended. I created a c# executable that open a liltle application and open a IE wedriver. I then close it at the end of my process.

As a personal choise the c# executable is a web app, it makes it easyer to close and I can use it to store data if need be.

Hope this help!
 
Top