possible to run powershell script from Selenium IDE test?

1,099 views
Skip to first unread message

H. Merrill

unread,
Sep 1, 2015, 1:24:26 AM9/1/15
to Selenium Users
I'm a Selenium newbie and an automated testing newbie, but an experienced programmer.  I've created a test suite in Selenium IDE that loops through the rows in a table building information for an email.  When I've processed all the rows in the table, I'd like to send an email.  So questions are:

1. is it possible to send email from within Selenium IDE?
2. is it possible to invoke a powershell script from within Selenium, and if so, how?  I wrote a powershell script that sends email using Outlook - if I am able to invoke that powershell script from within Selenium, that will solve my problem.

I'm in a very restricted environment where I have almost NO ability to install anything.  I tried installing Node.js as the first step in installing java so that I can program Selenium tests in java, but I can't even install Node.js.  I'm not even sure how I was able to install Selenium IDE.  So I need to make due with powershell and Selenium IDE.

Thanks for any help.

Jegadeesh mani

unread,
Sep 1, 2015, 5:01:37 AM9/1/15
to seleniu...@googlegroups.com

Hi merill,

Selenium IDE we can send a email. But will have lot of issue while sending an email. So, as of my suggestion please go forward with selenium webdrive.

Please look it selenium website.

Thanks
Jegadeesh

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f0414594-6bca-443d-9fc6-7d0eba307a91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

H. Merrill

unread,
Sep 1, 2015, 8:46:06 AM9/1/15
to Selenium Users
In order to use Selenium Webdriver, don't I at least have to install Java?  As I said, I tried installing Java and I can't - this machine is very tied down and I have almost NO ability to install software on it.  What is the minimum I need in order to user Selenium Webdriver?

Thanks for any information.

Jim Evans

unread,
Sep 1, 2015, 8:58:07 AM9/1/15
to Selenium Users
Nope. You can use nearly any programming language you like. The project provides language bindings for Java, Ruby, Python, JavaScript, and .NET. Additionally, there are third-party language bindings for myriad other languages like Perl, PHP, and Haskell. As you've mentioned PowerShell, I should point out that the .NET bindings can be used directly from PowerShell, just like any other .NET library, even if the syntax is supremely awkward.

H. Merrill

unread,
Sep 1, 2015, 9:11:13 AM9/1/15
to Selenium Users
Thanks Jim.

My understanding is that in order to use Selenium Webdriver, I need to have a programming language available - the problem is that I don't have one.  Is this correct?

Selenium IDE seems to be able to execute JavaScript code - that's about the only language I have access to.  This machine is a Windows 7 machine - I've tried installing Java and Python - can't install either.  I work for a state agency and this machine is very tied down - I don't have administrator access, and to install any software, a prompt appears that wants an administrator userid/pw.  I'm pretty certain I won't be able to install any other development tools without having to make a formal case and get it approved.  I'm trying to get some Selenium IDE tests to a point where I can show that it is useful, so then I can make the case to get additional access to be able to install some development tools like a programming language and Selenium Webdriver.

So given my current environment (Selenium IDE with no other programming language support except maybe javascript), can I make a test
   * send email, and/or
   * invoke a powershell script to send email

??  Thanks again.

Hardy


On Tuesday, September 1, 2015 at 8:58:07 AM UTC-4, Jim Evans wrote:

Krishnan Mahadevan

unread,
Sep 1, 2015, 9:42:08 AM9/1/15
to seleniu...@googlegroups.com
When it comes to Java, you don’t necessarily need to install Java.

Can you try the following ?

  • On a machine which has Java already installed, find the installation folder and create a zip file out of it. [ You can also refer to this SO link http://stackoverflow.com/a/6571736 ]
  • Now copy this zip file to your target machine and unzip it there.
  • You can then rely on batch files to setup the Java PATH variable, CLASSPATH etc., and you should be able to get it to work.
  • Now you can basically run your suite generated via the Selenium IDE using the standalone uber jar.
Would that work ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

H. Merrill

unread,
Sep 3, 2015, 6:08:51 AM9/3/15
to Selenium Users
I am going to try this, but I have a question.  Assuming it works, will it be an updatable version of Java?  In other words, will it be able to get security and other updates?  Or will a new version have to be installed using this same method of install you described above, each time the original version gets updated?

Any idea if Python can be installed the same way you describe the Java install - install it first on another machine, and then just zip it up and unzip it on the target machine and maybe update the PATH?

Thanks.

Krishnan Mahadevan

unread,
Sep 3, 2015, 8:02:49 AM9/3/15
to seleniu...@googlegroups.com
Merrill,

No it won’t be an updatable version of Java. Remember we just copied a folder and putting in a different machine. its not equivalent to an installation. So you would need to redo the same process whenever you would need to update a new version.

As far as python is concerned, I am not very sure about it. 

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Serguei Kouzmine

unread,
Sep 5, 2015, 4:01:16 PM9/5/15
to Selenium Users
As already mentioned you can run Selenium WebDriver from Powershell. The only dependency is the Selenium C# Assembly which you can download and load into Powershell. This way you will be able to still use your exiting email sending code.
Powershell is a little verbose because you have to provide full class names

Like

[OpenQA.Selenium.Chrome.ChromeOptions]$options = New-Object OpenQA.Selenium.Chrome.ChromeOptions

$selenium = New-Object OpenQA.Selenium.Chrome.ChromeDriver ($options)

$base_url = '...'

$selenium.Navigate().GoToUrl($base_url )

[void]$selenium.Manage().timeouts().SetScriptTimeout([System.TimeSpan]::FromSeconds(100))
# protect from blank page
[OpenQA.Selenium.Support.UI.WebDriverWait]$wait = New-Object OpenQA.Selenium.Support.UI.WebDriverWait ($selenium,[System.TimeSpan]::FromSeconds(10))
$wait.PollingInterval = 150
[void]$wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementExists([OpenQA.Selenium.By]::ClassName('logo')))

...

$selenium.Close()
Reply all
Reply to author
Forward
0 new messages