Selenium-WebDriver won't work with proxy - firefox

I have a couple of dev machines. One works, the other doesn't.
Setup that doesn't work:
Host: quad
Firefox: 13.0.1
Ubuntu: 12.04 Desktop
Ruby: 1.8.7 (2011-06-30 patchlevel 352)
RubyGems: 1.8.15
Selenium-WebDriver: 2.24.0
Proxy: 192.168.1.70:8118
Setup that does work:
Host: dev
Firefox: 13.0
Ubuntu: 12.04 Desktop
Ruby: 1.8.7 (2011-06-30 patchlevel 352)
RubyGems: 1.8.24
Selenium-WebDriver: 2.22.2
Proxy: 127.0.0.1:8118
In the setup that doesn't work (host quad) Firefox will pop up but then log an error regarding an unexpected 503 response (I use Privoxy and on the machine that doesn't work I make the proxy available to the whole LAN, so my proxy is 192.168.1.70:8118).
Firefox opens and doesn't close when the Ruby script crashes. So I've been able to use that Firefox instance to surf the internet. That works fine. So Firefox is able to start up and go through Privoxy just fine. The Privoxy 503 page never shows up on the Firefox I'm seeing pop up only in the logs.
I've also tried this script (on host quad) with Chrome. Same error in the logs but Chrome never pops up a window for me. I assume this is due to the difference in the way proxies are handled by the 2 browsers.
On host dev, this script works fine. The script works without error when the proxy is 127.0.0.1:8118 (it's local Privoxy). Since the Privoxy on host quad is available to the whole LAN I changed the proxy setting on host dev to 192.168.1.70:8118. Once I did this I ran the script on host dev and got the Privoxy error in the terminal but Firefox opened and executed the rest of the script as if the error never happened.
My assumption is that this is a subtle difference in my setup that is causing issues. But I don't know if it is Firefox 13.0.1. vs 13.0 or my version of RubyGems or my version of Selenium-WebDriver.
I figure that ideally I should have the same setup on both machines. But which setup is better? I'd prefer to be able to work with the latest Firefox just because I get sick of telling the Update Manager in Ubuntu to not execute all the Firefox updates every day. And when I run apt-get update/upgrade I don't want to have to manually remove all of the Firefox updates. That said, if the best setup is to use Firefox 10, Ruby 1.8.7, RubyGems ... then I'll just go setup some VM that I don't bother running apt-get update/upgrade on so I have a more stable environment.
Thanks

Turns out it was a forward setting in Privoxy. I had to setup forwarding for 127...*/ in /etc/privoxy/config. I had already setup forwarding for 192.168../ and thought that was fine since the Proxy IP was 192.168.1.70 but it wasn't good enough.

Related

Failed to open TCP connection to 127.0.0.1:9515 rspec testing

I have an rspec/selenium/capybara suite that has been working flawlessly for months. Now suddenly I am getting a whole host of errors:
Failed to open TCP connection to 127.0.0.1:9515 (Only one usage of each socket address (protocol/network address/port) is normally permitted
I am testing an actual website, not a local instance so I don't know why 127.0.0.1 is showing up at all. I know there are a number of other questions similar to this on here, but I have yet to find one that addresses my issue.
Not sure what other information to include...
Port 9515 is the default port for chromedriver, so the connection attempt to 127.0.0.1:9515 is selenium attempting to connect to chromedriver in order to control the browser (Chrome) - The error would tend to indicate that chromedriver isn't starting up correctly. Check you have the latest version of chromedriver installed (or at least one that is compatible with the version of Chrome you're using') and also update selenium-webdriver. If using the chromedriver-helper gem you need to do bundle exec chromedriver -v when checking which version you're actually using since it installs a shim that can end up with you using a different version than it would appear if you just ran chromedriver -v

Install chromedriver using a remote host

I deployed my application using Ruby, Sinatra and Redis DataBase, on my ubuntu remote host named Scaleway.
In this way, i've install all what i need, and i can acces to my application. So when i want to use my script, who use Watir gem (selenium), it's always show me this error :
Selenium::WebDriver::Error::WebDriverError at /show_result
unable to connect to chromedriver 127.0.0.1:9515
I know that i need Xvfb (who is installed), the headless gem (that i implemented in my code), and chromedriver that i installed by the same way that i installed it on my local machine.
On my local machine, it works perfectly, but in my remote host, it show me this error above.
Did you know how to fix this problem ? How did you install Chromedriver so that my program recognizes it ?
Did you run the watir command using xvfb with something like this
xvfb-run <here is your command>
Also Chromedriver should place properly so it can be access anywhere, usually I put chromedriver at /usr/bin/ or /usr/sbin/

Pycharm docker remote python interpreter

When trying to configure a Remote Python Interpreter in Pycharm using Docker I get the following error:
com.github.dockerjava.api.excepion.DockerClientException: Enabled TLS
verification (DOCKER_TLS_VERIFY=1) but certificate path
(DOCKER_CERT_PATH) '/Users/me/.docker/machine/machines/default'
doesn't exist.
I've $export DOCKER_TLS_VERIFY=0 but with no difference.
I've manually created '/Users/me/.docker/machine/machines/default' but with no joy.
I've deinstalled and reinstalled both Docker and Pycharm but still get the same error.
I'm on a Mac OSX 10.12.1
Pycharm 2016.3
Full disclosure: I use vagrant and virtual box on my mac too.
Any pointers would be appreciated.
Kevin
I fixed it as follows:
Obtain socat (if not already installed)
e.g. brew install socat
Then: socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock
Then in pycharm/docker config:
Api URL: tcp://localhost:2375
Many thanks to the following found on:
https://youtrack.jetbrains.com/issue/IDEA-153973
If you have been using docker-machine for Mac to support PyCharm or the "socat" hack to access Docker API - It is no longer necessary with PyCharm EAP (https://www.jetbrains.com/pycharm/nextversion/) — You can set your remote debugger API_URL directly to: unix:/var/run/docker.sock (supporting debug mode, and the environment runs a lot faster, when not using VirtualBox).
There is a no-questions-asked 30 day trial of EAP before that update goes live (some time this month)

rails s doesn't start server, no error messages

I haven't been able to find previous answered questions on this, unless I'm missing one. Anyways, when I try starting a rails server:
vagrant [accounts]> rails s
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-06-06 02:38:50] INFO WEBrick 1.3.1
[2015-06-06 02:38:50] INFO ruby 2.2.2 (2015-04-13) [i686-linux]
[2015-06-06 02:38:50] INFO WEBrick::HTTPServer#start: pid=23016 port=3000
But that's all I ever get, no error messages or anything. Of course localhost:3000 produces 'no data received'
As you can see I'm using Ruby 2.2.2 and Rails 4.2.1
I'm in the root for the app, have tried updating bin.
I'm using the sqlite3 gem, I've created and migrated the db.
I am convinced it has nothing to do with this particular rails app because I've gone back and tried to open old projects that are now having the same problem. Recently I've upgraded from Ubuntu 12.04 to 14.04 on my vm. I've also recently upgraded ruby (I manage with rvm) and rails. I've also recently put some stuff on heroku. All of this has messed with $PATH (I'm not sure if this is related, I'm pretty new to all this stuff). Just wanted to detail everything I could think of that might have an effect.
Thanks!
I ran into the following problem recently, could this be your issue also?
If so try
rails s -b 0.0.0.0
3.3 Default Host for rails server Due to a change in Rack, rails server now listens on localhost instead of 0.0.0.0 by default. This
should have minimal impact on the standard development workflow as
both http://127.0.0.1:3000 and http://localhost:3000 will continue to
work as before on your own machine.
However, with this change you will no longer be able to access the
Rails server from a different machine, for example if your development
environment is in a virtual machine and you would like to access it
from the host machine. In such cases, please start the server with
rails server -b 0.0.0.0 to restore the old behavior.
If you do this, be sure to configure your firewall properly such that
only trusted machines on your network can access your development
server.
See the release notes here for the details.

Xdebug and Netbeans are not communicating with each other

I have spent a couple of days surfing the internet to find an answer to my question. I have tried everything I could but have been unsuccessful thus far in solving this problem. Netbeans keeps giving Waiting for Connection (netbeans-xdebug).
I am using the following software:
XAMPP Version 1.8.1.
Windows 7
Netbeans IDE 7.2.1
Xdebug 2.2.1
I installed the latest version according via the wizard for the xdebug.org site (http://xdebug.org/wizard.php). Xdebug is working according to phpinfo().The HMTL output in my browser (Firefox 17.0.1) shows xdebug code. However this is not communicated back to netbeans. Using Netstat via command prompt (Run -> cmd.exe) shows that there is a TCP connection on port 9000. However , nothing is reported back in Netbeans.
I have tried several different alternatives, for example:
Installing a similar IDE, Eclipse PDT. Eclipse shows that Xdebug is
working. However, because Eclipse is lacking functions I need I
wanted to use Netbeans.
Installing Netbeans on Ubuntu 12.04 LTS.
Still the same problem. Netbeans not working (waiting for
connection). Also output in browsers shows that Xdebug is working.
Whenever I install on a new Linux machine: "php xdebug" and netbeans I run these simple steps and I've always managed to corect integration of xdebug on netbeans.
So with the data you provide, I can only help you solve, the half of your problem. Allowing you to connect on Linux machines:
Installation with pecl:
# apt-get install php5-dev php-pear
# pecl install xdebug
Or direct installation:
# apt-get install php5-xdebug
find the library:
# find / -name 'xdebug.so'
/usr/lib/php5/20090626+lfs/xdebug.so
Edit phi.ini file:
...
zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
...
Restart web-server in your case: Apache
$ /etc/init.d/apache2 restart
According to what you have posted:
Installing Netbeans on Ubuntu 12.04 LTS.
I have used the installation method "apt-get" for distributions ".deb".
If you are using a distribution ".rpm" can do the same with "yum"
Many of these commands are surely simplified within the xampp.
But if you running this commands from console will not affect the final result.
Another important note about Windows's machines and Linux's machines,
You should check that your firewall rules are allowing to establish a connection from netbeans to xdebug.
I know this is old but for people using Ubuntu this might help.
OS Version = Ubuntu 14.04.3 LTS; Codename: trusty
PHP Version = PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:17:32)
Apache Version = Server version: Apache/2.4.7 (Ubuntu)
Procedure
Install xdebug for php5
sudo apt-get install php5-xdebug
Open php.ini and add the following lines below (usually sudo vim /etc/php5/apache2/php.ini)
xdebug.remote_enable=On;
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000;
xdebug.remote_handler="dbgp";
Restart apache and your good to go
sudo service apache2 restart
Note 1: I have not tried doing this without firefox add-on for xdebug, so if after doing the procedure above and still to no avail, download the add-on for firefox Easy Xdebug
Note 2: I did not touch the PHP Configuration of Netbeans
Note 3: I did not touch xdebug.ini

Resources