Use Selenium automation using perl - selenium

I am in a requirement to download multiple files (from a private/internal network) on daily basis.
For which I intended to use selenium with perl to daily download the files from respective locations. I am very new to this domain and need your help.
As a sample program, i am trying to simply connect google.com but it is not getting connected.
my $sel = WWW::Selenium->new( host => "localhost",
port => 80,
browser => "*iexplore",
browser_url => "http://www.google.com",
);
$sel->start;
$sel->open("http://www.google.com");
$sel->type("q", "hello world");
$sel->click("btnG");
$sel->wait_for_page_to_load(5000);
print $sel->get_title;
$sel->stop;
ERROR - > Error requesting http://localhost:4444/selenium-server/driver/:
500 Can't connect to localhost:4444 (Bad address)
i changed the port to 80 and then i get error as:
Error requesting http://localhost:80/selenium-server/driver/:
404 Not Found
Any inputs would be highly appreciated.

Related

Roundcube SSL connection IMAP Error: Login failed

This is probably a reoccurring problem, where you are unable to Login to Roundcube (Connection to storage server failed), due to an IMAP (ssl) connection error.
Many Posts reports this as an IMAP issue, and tells you that this is due to the config/config.inc.php Imap configuration, but are failing to give any proper debugging of the IMAP.
So, this is another post, of the same problem : Unresolved.
Roundcube reports this error:
IMAP Error: Login failed for user#myserver.com against host.myserver.com from IP_ADDRESS. Could not
connect to ssl://host.myserver.com:993: Unknown reason in
../lib/Roundcube/rcube_imap.php on line 200 (POST /webmail/?_task=login&_action=login)
I tried this to check if ssl connection to imap was possible:
openssl s_client -connect host.myserver.com:993
And I am able to connect to the IMAP with ssl, but connection ends with :
BYE Too many invalid IMAP commands.
So ... it seem that the ssl certificate is valid, and I am able to connect on port 993.
Roundcube still reports an Unknown reason for not connecting properly.
The certificate was generated by the ./mkcert.sh bash script, where you can enter the proper hostname of your server, to be included in the certificate.
After a lot of debugging, and no proper debugging methodology I found the easy solution, by bypassing ssl verification.
A stupid solution:
$config['imap_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
'verfify_peer_name' => false,
),
);
$config['smtp_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
);
Do anyone have some suggestions for the next thing to try
Thanks!

Magento SOAP API: wsdl soap:address location incorrect

I'm trying to connect to a Magento instance using the SOAP API v2, and although I can see the wsdl when I visit http://www.domain.loc/api/v2_soap?type=soap&wsdl=1 in my browser, I am unable to execute the login() call, an error is always thrown.
Code:
$options = array(
'trace' => 1,
'cache_wsdl' => WSDL_CACHE_NONE,
//'location' => 'http://www.domain.loc/index.php/api/v2_soap?wsdl=1',
'soap_version' => SOAP_1_2,
'connection_timeout' => 120,
'exception' => 0,
'encoding' => 'utf-8',
);
try {
$client = new soapClient('http://www.domain.loc/api/v2_soap?type=soap&wsdl=1', $options);
$client->login('username', 'password');
//$result = $client->catalogProductList($sessionId);
//$result = $client->call($session, 'catalog_product.list');
var_dump($client);
} catch (SoapFault $e) {
var_dump($e);
}
Which yields "SoapFault: looks like we got no XML document"
When I uncomment the location option I get "SoapFault: Wrong Version"
When I view the wsdl file, I see the soap:address location set as
<port name="Mage_Api_Model_Server_HandlerPort" binding="typens:Mage_Api_Model_Server_HandlerBinding">
<soap:address location="http://www.domain.loc/index.php/?SID=7o7mn7iiu9tr8u1b9163r305d4dp1l1jrcn1hmnr34utgnhgb6i0&type=soap"/>
Which seems incorrect as it is the URL to the homepage, with the SID and a query param.
Magento version EE1.14
Things I have tried:
Disable local modules - no change
Using Zend_Soap_Client - no change
Various different URL configurations - tried everything under the
sun, no change
Using SOAP v1 - same results
Tried using this on a remote instance instead of my local - same
result
Checked phpinfo - yes SOAP is installed
Tried debugging - When I turn on Xdebug and run my test script it
seems to prevent the script from even running. Browser just
indicates loading forever
Tried to uncomment line in .htaccess to rewrite RewriteRule
^api/([a-z][0-9a-z_]+)/?$api.php?type=$1 [QSA,L] - No change
(yes mod rewrite is on and working)
Tried fetching wsdl and saving locally and passing it into SOAP
client constructor - no change
Anyone know how to troubleshoot this? I see several threads with these errors, but either unanswered or have tried their solution and it did not work in this case. Why is my location in the wsdl incorrect? Any help at all would be appreciated. Thanks!

logstash and centralised redis problems

I'm trying to get logstash working in a centralised setup using the docs as an example:
http://logstash.net/docs/1.2.2/tutorials/getting-started-centralized
I've got logstash (as indexer), redis, elasticsearch and standalone kibana3 running on my web server. I then need to run logstash as an agent on another server to collect apache logs and send them to the web server via redis. The number of agents will increase and the logs will vary, but for now I just want to get this working!
I need everything to run as a service so that all is well after reboots etc. All servers are running Ubuntu.
For all logstash instances (indexer and agent), I'm using the following init script (Ubuntu version, second gist):
https://gist.github.com/shadabahmed/5486949#file-logstash-ubuntu
For running redis as a service, I followed the instructions here:
http://redis.io/topics/quickstart (Installing redis more properly)
Elasticsearch is also running as a service.
On the web server, running redis-cli returns PONG correctly. Navigating to the correct Elasticsearch URL returns the correct JSON response. Navigating to the Kibana3 url gives me the dashboard, but no data. UFW is set to allow the redis port (at the moment from everywhere).
On the web server, my logstash.conf is:
input {
file {
path => "/var/log/apache2/access.log"
type => "apache-access"
sincedb_path => "/etc/logstash/.sincedb"
}
redis {
host => "127.0.0.1"
data_type => "list"
key => "logstash"
codec => json
}
}
filter {
grok {
type => "apache-access"
pattern => "%{COMBINEDAPACHELOG}"
}
}
output {
elasticsearch {
embedded => true
}
statsd {
# Count one hit every event by response
increment => "apache.response.%{response}"
}
}
From the agent server, I can telnet successfully to the web server IP and redis port. logstash is running. The logstash.conf file is:
input {
file {
path => "/var/log/apache2/shift.access.log"
type => "apache"
sincedb_path => "/etc/logstash/since_db"
}
stdin {
type => "example"
}
}
filter {
if [type] == "apache" {
grok {
pattern => "%{COMBINEDAPACHELOG}"
}
}
}
output {
stdout { codec => rubydebug }
redis { host => ["xx.xx.xx.xx"] data_type => "list" key => "logstash" }
}
If I comment out the stdin and stdout lines, I still don't get a result. The logstash logs do not give me any connection errors - only warnings about the deprecated grok settings format.
I have also tried running logstash from the command line (making sure to stop the demonised service first). The apache log file is correctly outputted in the terminal, so I know that logstash is accessing the log correctly. And I can write random strings and they are output in the correct logstash format.
The redis logs on the web server show no sign of trouble......
The frustrating thing is that this has worked once. One message from stdin made it all the way through to elastic search. That was this morning just after getting everything setup. Since then, I have had no luck and I have no idea why!
Any tips/pointers gratefully received... Solving my problem will stop me tearing out more of my hair which will also make my wife happy......
UPDATE
Rather than filling the comments....
Thanks to #Vor and #rutter, I've confirmed that the user running logstash can read/write to the logstash.log file.
I've run the agent with -vv and the logs are populated with e.g.:
{:timestamp=>"2013-12-12T06:27:59.754000+0100", :message=>"config LogStash::Outputs::Redis/#host = [\"XX.XX.XX.XX\"]", :level=>:debug, :file=>"/opt/logstash/logstash.jar!/logstash/config/mixin.rb", :line=>"104"}
I then input random text into the terminal and get stdout results. However, I do not see anything in the logs until AFTER terminating the logstash agent. After the agent is terminated, I get lines like these in the logstash.log:
{:timestamp=>"2013-12-12T06:27:59.835000+0100", :message=>"Pipeline started", :level=>:info, :file=>"/opt/logstash/logstash.jar!/logstash/pipeline.rb", :line=>"69"}
{:timestamp=>"2013-12-12T06:29:22.429000+0100", :message=>"output received", :event=>#<LogStash::Event:0x77962b4d #cancelled=false, #data={"message"=>"test", "#timestamp"=>"2013-12-12T05:29:22.420Z", "#version"=>"1", "type"=>"example", "host"=>"Ubuntu-1204-precise-64-minimal"}>, :level=>:info, :file=>"(eval)", :line=>"16"}
{:timestamp=>"2013-12-12T06:29:22.461000+0100", :level=>:debug, :host=>"XX.XX.XX.XX", :port=>6379, :timeout=>5, :db=>0, :file=>"/opt/logstash/logstash.jar!/logstash/outputs/redis.rb", :line=>"230"}
But while I do get messages in stdout, I get nothing in redis on the other server. I can however telnet to the correct port on the other server, and I get "ping/PONG" in telnet, so redis on the other server is working..... And there are no errors etc in the redis logs.
It looks to me very much like the redis plugin on the logstash shipper agent is not working as expected, but for the life of me, I can't see where the breakdown is coming from.....

PHPStorm unable to make external connection with xdebug

My OS is Mac Mountain lion.
My PhpStorm version is 5.0.4.
Here is my php xdebug info:
xdebug.remote_autostart => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 127.0.0.1 => 127.0.0.1
xdebug.remote_log => data/logs/xdebug.log => data/logs/xdebug.log
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.idekey => no value => no value
I can debug PhpScript Run Type in PhpStorm,It works fine.So I think xdebug configure well.
But after I try follow the "Zero Configure Debug"(Which with Webapplication Run Type),Phpstorm can not connect with the incoming connection.
Here is my step:
Click Start Listion Php Connection.(Toggle the call to green)
Click Run->Break at first line in PhpScript,and set breakpoint at first statement.
Choose My WebApplication Config and click Debug button.Then it launches chrome and link to my phpscript.(with ?XDEBUG_SESSION_START=19869)
In PhpStorm,Debugger shows Waiting for incoming connection with ide key '19869'.
In termial,printlsof -i4TCP:9000.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
webide 288 wangfeng 69u IPv6 0xa83881cdce30c579 0t0 TCP *:cslistener (LISTEN)
Open Chrome's Developer Tool,Select Cookies.
XDEBUG_SESSION 19869 localhost / Wed, 30 Jan 2013 05:27:17 GMT 19
Refresh Chrome.Not able connect with PhpStorm debug connection.
Additional:
My firewall was closed.
My Server is nginx.My phpwebapp and server is all at my local machine.
Does it cause ipv6?
Hopes help!I have try everything,extensions bookmarklets,not work at all.
It's possible that port 9000 is being used by some other process.
In php.ini set xdebug.remote_port=9001 or another unused port of your choosing.
In PHPStorm go to Settings->PHP->Debug and under the Xdebug section set Debug port to 9001.
Restart your web server.
Start debugging.
After checking all the configuration in php.ini file and the IDE, do not forget to add the browser-specific extension that basically communicates via the IDE via IDE Key.
Please refer to this link

how to syslog-ng to remote facility

i have a host running syslog-ng. it does all it's stuff locally fine (creating log files etc). however, i would like to forward ALL of it's logs to a remote machine - specifically to one facility on the remote machine (local4). i tried playing around with rewrite (set-facility) and templates within the destination (syntax errors) - but to no avail.
destination remote_server {
udp(\"172.18.192.8\" port (514));
udp(\"172.18.192.9\" port (514));
};
rewrite r_local4 {
set-facility(local4);
};
filter f_alllogs {
level (debug...emerg);
};
log {
source(local);
filter(f_alllogs);
rewrite(r_local4)
destination(remote_server);
};
AFAIK, currently it is not possible to modify the facility of a message in syslog-ng.
Is there a special reason you want to do it?