jaypal has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Selenium::Remote::Driver; my $url = 'http://my_internal_url.com'; my $driver = Selenium::Remote::Driver->new( 'browser_name' => 'phantomjs', 'port' => '8089' ); $driver->get( $url ); $driver->find_element("//a[contains(.,'serviceone')]")->click(1); $driver->find_element("//input[\@value='Stop Service']")->click(1); $driver->find_element("//a[contains(.,'servicetwo')]")->click(1); $driver->find_element("//input[\@value='Get Status']")->click(1);
I can see from the logs that the script does work. It worked fine when I was testing it by having the driver click on just one service. Since that was not going to be the only purpose of this script (it will do several other things for a particular service, then select another service, do stuff for it and then another service...etc) I started testing with two services.
This led to the issue I am having. During some runs both buttons gets pushed for serviceone and during some runs both buttons gets pushed for servicetwo. Sometimes just one button gets pushed for any one service.
I can't seem to figure out why is it happening. I have added sleep, set_implicit_wait_timeout, pause but the issue prevails.
The webpage doesn't have url but javascript onclick events.
Looking forward to your wisdom.
Regards
Jaypal
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Selenium with PhantomJS not able to click links correctly
by Loops (Curate) on Jul 19, 2014 at 10:23 UTC | |
by jaypal (Beadle) on Jul 19, 2014 at 23:54 UTC | |
by Anonymous Monk on Jul 20, 2014 at 02:15 UTC |