I'm using webdriver for my integration tests. I want to run the test suite for the url:
https://test.url.net
but I have some constraints that are beyond my control.
I need to run the tests on my local environment.
I cannot use localhost as my url
I solved this by adding an entry in /etc/hosts/ to map localhost to my url
$ cat /etc/hosts
127.0.0.1 test.url.net
when I run webdriver targeting https://test.url.net it just hangs and cannot connect, however, when I try to target https://localhost:443/ the test opens (and fails due to the constraint that we can't use localhost as a domain).
Is there a way to provide webdriver with a mapping of url to ip address?
https://test.url.net is directing only 127.0.0.1 / localhost. But you have to mention the port number.
try https://test.url.net:443 in browser manually and check if the website loads.
if yes then use this url with port number in webdriver.io
Related
I am not sure how or if this can be done. I have a home network and would like to see a computer,not the server, via a remote location. I have Apache on my server. Example: the network computers I would like to see ip 152.254.1.33. Is there a way to add this ip to Apache root directory? I have tried to add a shortcut with in the root directory and it only works on the home network, will not via remote connection.
I need some clarification here on what you are trying to acomplish, are you trying to access the Apache website outside of the local network?
If that is the case, Apache is automatically set to listen on all network interfaces, you can check this in your virtual host configuration in the sites-enabled directory of your apache installation.
You should see something like in the 000-default.conf
You can test if apache is serving pages up correctly using the command
curl 127.0.0.1
You should see the HTML of the page being served.
If this is the case, then it's likely the firewall on your machine/router or your ISP is blocking the required ports. You can allow Apache through the firewall on Ubuntu using sudo ufw allow Apache Full
If you give me some more info in comments we can probably work this out.
I had to recently wipe my PC and I'm setting up my development environment again using WAMP.
After installing WAMP, if I visit http://localhost instead of seeing the WAMP homepage I get redirected to http://x.x.x.x, where x.x.x.x is my IP.
I had this issue on another PC and after setting the inbound rules for Apache HTTP Server in my Windows Firewall settings to allow all domains it fixed the issue. I applied this to my PC, and the issue does not seem to be present for Internet Explorer, whereas for Chrome and Firefox the localhost to my IP redirect issue persists even after clearing the cache for each browser.
My C:\Windows\System32\drivers\etc\hosts file looks like this:
127.0.0.1 localhost
::1 localhost
and my firewall rules look like this:
I am not currently using vhosts and I'm on a network at my workplace (if that has any implications?)
I also encountered the same issue when using Laragon which uses vhosts and whenever I visited a virtual host, e.g. mysite.dev it didn't work properly either.
My question on the Laragon forum: https://forum.laragon.org/topic/126/accessing-mysite-dev-redirects-to-url-which-shows-index-php-at-root-folder/3
The Problem
I'm behind a proxy which is used for browsing the web at my workplace. The proxy seemed to be messing up the dns resolution whenever I made a call to localhost (when using wamp) or one of my vhosts (when using Laragon).
This was clear as when I ran the following from the command line: ping site.dev I was getting the expected response from 127.0.0.1. However, when going to site.dev in my browser I was getting redirected to my IP, so essentially my etc/hosts file was being ignored for dns resolution.
The difference between the two being that the browser is using the proxy whereas the command line isn't!
The Solution
After trying many different solutions which seemed to work for localhost (on wamp) only, but not vhosts (on Laragon) I finally got to the solution which was actually so simple!
So, for chrome I simply went to chrome://settings/ > Network - Change proxy settings > LAN Settings > Proxy Server - Advanced
Then in the Exceptions text box I added the following:
*.dev;localhost;127.0.0.1
Here's a screenshot of my settings from Chrome/Internet Options
And that did the trick! Hope this can help someone else.
I want to set up a machine for testing a website before launching it. Some of the tests require logic in parsing the current host.
I want to be able to test it in my browser but i can only access it through the localhost.
I want to know how to make my browser resolve my domain to 127.0.0.1:80. (Also I don't want my DNS record to point to my test machine, this should be a local test only).
Also, is there a way to make all sub-domains of my domain access 127.0.0.1:80 as well?
Extra Info --
OS: Windows 7
Browser: Chrome
Web Server: Tomcat 7
Thank You.
EDIT ---
The solution was to add a few lines to the host file:
127.0.0.1 example.com
etc.
You're looking for the hosts file. It's more than likely what points localhost to 127.0.0.1 on your computer.
You can find it at C:\Windows\System32\drivers\etc\hosts on Windows. Or /etc/hosts on most Linux systems, if you're interested.
I am trying to write a cucumber test which uses Watir Webdriver and selenium with the Headless gem.
I get the error:
Timeout::Error: Timeout::Error
from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'
When trying to open a page on a hostname that is mapped to a local connection (custom hostname mapped to 127.0.0.1) which is then set up as a virtual server in Apache.
I have a default system proxy which needs to be avoided for this connection because it should not use the proxy for local connections. I have already added the ignore proxy host to my ubuntu configuration.
How can I tell my Watir firefox profile NOT to use a proxy and instead direct connection. Or, how can I tell the profile to ignore the proxy for the custom hostname?
Everywhere in the documentation just mentions setting up a proxy, not how to disable it or how to ignore hosts in it.
The code I have is:
require 'watir-webdriver'
require 'headless'
Headless.new.start
b = Watir::Browser.new
b.goto 'http://gi-local'
Which then times out on the goto.
I have also tried adding:
profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.no_proxies_for']='localhost, 127.0.0.1, gi-local'
b = Watir::Browser.new :firefox, :profile => profile
b.goto 'http://gi-local'
But this still times out.
Solved. Needed to set all the proxy settings, not just the no_proxies part and also make sure to use numbers for ports instead of strings.
I'm running a website at http://localhost:8080/sitename. However, when I'm trying to create a network of sites with wordpress, I'm getting the following error under Tools-> Network:
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080.
I tried to create a virtual host and a fake domain but I can't make it work.
How can I solve that?
At this moment, Wordpress only seem to support 80 and 443 ports. A temporary possible workaround to use any custom (i.e. http 8080) port:
Open wp-admin/includes/network.php and find the section of code where it mentions array( ':80', ':443' ) and add :8080 too in that array.
After completing setup of network, you might need in wp-config to adjust to such:
define( 'DOMAIN_CURRENT_SITE', 'example.com'. (stristr($_SERVER['PHP_SELF'],'wp-login.php') ? '':':8080') );
As noted in comments (thanks) after creating first sub-site, it might have port number embedded in domain name, so try to enter Mysql Database (i.e. try hosting's phpMyAdmin, or even installed plugin before starting procedure) and in _blogs & _site& _options tables, to adjust homepage urls of subsites(i.e. separate port number from domain).
That's all. Login again to your project.
From my experience, WP is not designed to use custom ports for multi-sites so the blogs (sub-sites) hosts get messed up in the DB.
My solution: After you switch to multi-site or create a new site, you need to go to your db admin page (e.g. phpMyAdmin) and fix the blogs domain in the wp_blogs table. Basically WP failed to add a colon between the host and port; just have to add it-> localhost8080 becomes localhost:8080.
So, on the site's settings add the missing colon to the siteurl and home urls.
I found temporary solution:
running "netstat -o -n -a | findstr 0.0.80" in CMD will show you wich service is using the port 80. If PID is 4 it means that port 80 is used by the system (propably IIS or web matrix if it is installed - this was my case). i changed the port IIS was using from IIS Manager and i also deactivated MsDepSvc service (Web Matrix) which was also using port 80. After that i reconfigured apache to work in port 80 and everything worked OK!