i ran into a problem that seems to be a bug in selenium but maybe someone can hint me to a solution anyway.
A similar question has been asked 11 months ago see: How can I change logfile path of phantomjs with selenium?
but it was not solved.
I'm using Selenium::Remote::Driver in Perl to connect to selenium. My code looks like this:
my $driver = new Selenium::Remote::Driver(
'remote_server_addr' => 'localhost',
'port' => "4444",
'browser_name' => 'phantomjs',
extra_capabilities => {
'phantomjs.cli.args' => ['--webdriver-logfile=/tmp/phantomjsdriver.log']
}
);
I found out that the phantomjs devs have integrated the parameter phantomjs.cli.args to pass parameters through to phantomjs. The parameters show up but unfortunately are added to the default parameters.
See the logfile of selenium:
10:20:29.207 INFO - Creating a new session for Capabilities [{platform=ANY, javascriptEnabled=true, acceptSslCerts=true, phantomjs.cli.args=[--webdriver-logfile=/tmp/phantomjsdriver.log], browserName=phantomjs, version=}]
10:20:29.208 INFO - executable: /usr/local/node/bin/phantomjs
10:20:29.208 INFO - port: 5710
10:20:29.208 INFO - arguments: [--webdriver-logfile=/tmp/phantomjsdriver.log, --webdriver=5710, --webdriver-logfile=/phantomjsdriver.log]
10:20:29.208 INFO - environment: {}
PhantomJS is launching GhostDriver...
Unable to open file '/phantomjsdriver.log'
On the 4th line you can see that my argument was passed but the default '--webdriver-logfile=/phantomjsdriver.log' is also part of the arguments.
I tried also to set the loglevel to NONE but it tries to open the logfile anyways.
Lastly i tried to start phantomjs with a config file but i couldn't figure out the config option for the logfile and i'm not sure that would help.
My selenium server runs as a daemon if that is important.
Any help is appreciated!
Have a nice day
Have you tried using new_from_caps method for full control of your driver instance? Using this option no defaults are assumed by the constructor.
e.g.
my $driver = Selenium::Remote::Driver->new_from_caps(
desired_capabilities => {
'browserName' => 'phantomjs',
'phantomjs.cli.args' => ['--webdriver-logfile=/tmp/phantomjsdriver.log']
}
);
See doc here: https://metacpan.org/pod/Selenium::Remote::Driver#new_from_caps
Related
I want to copy the file from remote host to the local host with the preservation of file permission, hence i tried to use the 'copy_perm' option as per the documentation of Net::SFTP::Foreign as mentioned below -
my $sftp = Net::SFTP::Foreign->new(
host => $host,
key_path => $ssh_key_path,
copy_perm => 1,
more => [ -o => 'Compression yes' ]
);
But I am getting the below error -
Invalid option 'copy_perm' or bad combination of options at test.pl at line 101.
The line 101 is the Net::SFTP::Foreign object creation as mentioned above.
Did i miss anything or anyone has faced same issue before?
That's because copy_perm isn't an option for the new method. You use it in get and put.
I am doing the tutorial from Marco Pivetta for Ocramius and Zend, I am stuck at the step where I should validate the schema. (See here: Link to the tutorial )
So actually I am stuck at the same point like at this question, already asked on stackoverflow.
The author on this question found the solution obviously, but for me it's not working.
He writes
And, if you use gitBash don't forget if you have tested your APPLICATION_ENV variable in application.config.php like this tutorial Zf2 advances config setup do in bash_profile file.
export APPLICATION_ENV="development"
I did this in my application.config.php
$env = getenv('APP_ENV') ?: 'development';
// Use the $env value to determine which modules to load
$modules = array(
'ZendDeveloperTools',
'Application',
'DoctrineModule',
'DoctrineORMModule',
);
if ($env == 'production') {
$modules[] = 'ZendDeveloperTools';
}
return array(
'modules' => $modules,
[...]
But I still get the error
[PDOException]
SQLSTATE[HY000] [1045] Access denied for user 'username'#'localhost' (using password: YES)
I have to say though, I couldn't figure out what the author means with the
[... ] bash_profile file:
export APPLICATION_ENV="development
His sentence is written without regarding any grammatical sense.
So the problem is:
Somehow my doctrine.local.php in the autoloads is ignored, I can't figure out why.
I am using GitBash for the
./vendor/bin/doctrine-module orm:validate-schema
command.
Got it:
Make sure you are using GitBash and ZendStudio in administrator mode -.-
I have written a simple Perl script to launch google. But it terminates with an error - Could not connect to SeleniumWebDriver at C:/perl/lib/Selenium/Remote/Driver.pm line 220
I am using selenium server version - 2.31
OS - windows7 (32 bit)
Perl Code
use warnings;
use strict;
use Selenium::Remote::Driver;
my $driver = Selenium::Remote::Driver->new( browser_name => 'firefox', port => 4444,
platform => 'ANY');
$driver->get('http://www.google.com');
sleep(5);
print $driver->get_title();
$driver->quit();
When i execute perl script, at each instance, on server command prompt i could see this line -
14:07:23.325 INFO - Executing: org.openqa.selenium.remote.server.handler.Status#
8e96fc at URL: /status)
14:07:23.327 INFO - Done: /status
But browser is not getting launched. Please can anybody help me about the issue?
Did you start the selenium server on a machine with firefox and X (assuming Linux)
and maybe add the proxy in
{remote_server_addr=>'localhost', port=>4444,proxy => { 'proxyType' => 'system' }}
can you post how you're starting selenium
I started the selenium server using command
"java -jar selenium-server-standalone-2.31.0.jar"
But the issue get resolved now. I guess it was Perl issue. I was using Active Perl V 5.16.
Then i installed Strawberry Perl V 5.18 and it worked.
Thank you!
I don't know why but I cannot launch browser using the below code. I am using EPIC on eclipse. I have installed required selenium modules for this.
I get this error when I run below mentioned code: "Could not connect to SeleniumWebDriver at C:/ProgramFiles/Perl/site/lib/Selenium/Remote/Driver.pm line 220"
Any help is appreciated.
Here is my code:
use Selenium::Remote::Driver;
my $driver = new Selenium::Remote::Driver(browser_name => 'firefox', port => 5555,
platform => 'WINDOWS');
$driver->get('http://www.google.com');
print $driver->get_title();
$driver->quit();
It might be closing the page before you notice it? Also, I think by default the port number selenium listens on is 4444.
Try this:
use Selenium::Remote::Driver;
my $driver = new Selenium::Remote::Driver(browser_name => 'firefox', port => 4444,
platform => 'ANY',);
$driver->get('http://www.google.com');
sleep(200);
print $driver->get_title(),"\n";
$driver->quit();
I changed the Selenium version to 2.31 and it worked. Previously I was using 2.28 which had incompatibility with FF 19
Charles, my PC was updated with new Java version and so my server start up file was failing to start the server. I corrected the start up file with correct java path and it launches the browser.
But I don't know why it gives blank page as it should open google.com
before run the code you should start the remote server.
Enter the path as below where your chrome driver and jar file are exited in your system and
Go to the command prompt an run the following command- please
java -Dwebdriver.chrome.driver="\Enter folder path\chromedriver.exe" -jar \Enter folder path\selenium-server-standalone-2.53.0.jar
and if you are using Firefox then write the following code.
my $driver = Selenium::Remote::Driver->new();
for chrome user following -
my $driver = Selenium::Remote::Driver->new(browser_name => 'chrome');
I'm trying to set up Selenium Grid 2 (Ubuntu-host for hub and Perl installed and Windows-host for various browsers (Firefox, IE, Chrome, Opera)). Everything works fine, I can start short sample test against IE, FF, Opera and see how browser is open and page is loaded. Here is the test:
#!/usr/bin/perl
use Selenium::Remote::Driver;
use Test::More tests=>4;
my $driver = Selenium::Remote::Driver -> new(
'browser_name' => 'internet explorer'
);
$driver->get("http://www.google.com");
$driver->quit();
But I can't make Chrome to work. I started Selenium-server with custom driver option on Windows-host (is this correct?) with
java -jar selenium-server-standalone-2.22.0.jar -role node -hub http://my-ubuntu-host:4444/grid/register -browser "browserName=chrome,version=19" -Dwebdriver.chrome.driver="c:\selenium-2-22-0\chromedriver.exe"
And when I attempt to run a test on Ubuntu-host with 'browser_name' => 'chrome' it only reports short error-message:
caligula#my-ubuntu-host:~/www$ ./test.pl
1..4
Could not create new session at ./test.pl line 5.
# Looks like your test exited with 255 before it could output anything.
Can somebody assist me with this? There are a lot of examples, but they are all in Java and I couldn't accommodate any of them to Perl code.
Also I noticed that chrome driver archive was named chromedriver_win_20.0.1133.0.zip. Is it compatible with selenium server 2.22 ? I've tried to use selenium server 2.20 but then nothing worked at all: nor FF, nor IE.
Required parameter 'proxy' => {HASH} was not passed to the constructor. Only chrome-driver throws an exception, whereas when you call FF or IE everything is fine.
There was short message in console:
org.openqa.selenium.WebDriverException: proxy must be of type dictionary, not null.
Received: null
creating Selenium::Remote::Driver instance in the following way solved the problem:
my $driver = new Selenium::Remote::Driver(
'browser_name' => 'chrome',
'proxy' => {
'proxyType' => 'system'
}
);