Document URL - Yash-777/SeleniumDriverAutomation GitHub Wiki
A web browser is a software application for retrieving, presenting, and traversing information resources on the World Wide Web. A Web browser is a program used to visit websites, while a search engine is a website that allows you to look for specific websites or information based on keywords, dates and other criteria. Common examples of Web browsers include Internet Explorer, Safari, Firefox and Chrome. Common examples of search engines include Google, Yahoo!, Bing and Ask
if you Search for a specific website from the Browsers Location bar then it goes through Browsers search engine.
Search type:
- Keyword « Then it get the list of related sites that has most views.
- URL « It gets that specific website. If URL is wrong the displays 404 Not Found error message.
open URL from browser by using Window.open() function - which Opens a new window and loads the document specified by a given URL.
var strUrl = 'https://www.google.com/';
var strWindowName = 'My Window 1';
var strWindowFeatures = new Array(`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=400, height=350`);
var windowObjectReference = window.open(strUrl, strWindowName, strWindowFeatures);
- protocol « Web-browsers use Internet Protocol by following some rules for communication between WebHosted Applications and Web Client(Browser). (http = 80, https (SSL) = 443, ftp = 21, etc.)
EX: With default port numbers
<protocol>//<hostname>:<port>/<pathname><search><hash>
https://en.wikipedia.org:443/wiki/Pretty_Good_Privacy
http://stackoverflow.com:80/
- (//) « Host is the name given to an end-point(machine on which resource lives) on the Internet.
www.stackoverflow.com -
DNS
IP Address of an Application (OR) localhost:8080 - localhost
Domain names are which you register by the rules and procedures of the Domain Name System(DNS) tree. DNS servers of someone who manages your domain with IP-Address for addressing purposes. In DNS server hierarchy the Root name of an stackoverlfow.com is com.
gTLDs - com « stackoverflow (OR) in « co « google
Local system you have to maintain domain's which are not PUBLIC in Host Files.
localhost.yash.com « localhsot - subdomain(
web-server
), yash.com - maindomain(
Proxy-Server
). myLocalApplication.com 172.89.23.777
- (/) « The path gives info about the specific resource within the host that the Web client wants to access
- (?) « An optional query is to pass a sequence of attribute–value pairs separated by a delimiter(&).
- (#) « An optional fragment is often an id attribute of a specific element, and web browsers will scroll this element into view.
Test URL :
http://stackoverflow.com/questions/5515310/is-there-a-standard-function-to-check-for-null-undefined-or-blank-variables-in/32942762?rq=1&page=2&tab=active&answertab=votes#32942762
resourceAddress.hash();
console.log('URL Object ', webAddress);
console.log('Parameters ', param_values);
Function:
var webAddress = {};
var param_values = {};
var protocol = '';
var resourceAddress = {
fullAddress : function () {
var addressBar = window.location.href;
if ( addressBar != '' && addressBar != 'undefined') {
webAddress[ 'href' ] = addressBar;
}
},
protocol_identifier : function () { resourceAddress.fullAddress();
protocol = window.location.protocol.replace(':', '');
if ( protocol != '' && protocol != 'undefined') {
webAddress[ 'protocol' ] = protocol;
}
},
domain : function () { resourceAddress.protocol_identifier();
var domain = window.location.hostname;
if ( domain != '' && domain != 'undefined' && typeOfVar(domain) === 'string') {
webAddress[ 'domain' ] = domain;
var port = window.location.port;
if ( (port == '' || port == 'undefined') && typeOfVar(port) === 'string') {
if(protocol == 'http') port = '80';
if(protocol == 'https') port = '443';
}
webAddress[ 'port' ] = port;
}
},
pathname : function () { resourceAddress.domain();
var resourcePath = window.location.pathname;
if ( resourcePath != '' && resourcePath != 'undefined') {
webAddress[ 'resourcePath' ] = resourcePath;
}
},
params : function () { resourceAddress.pathname();
var v_args = location.search.substring(1).split("&");
if ( v_args != '' && v_args != 'undefined')
for (var i = 0; i < v_args.length; i++) {
var pair = v_args[i].split("=");
if ( typeOfVar( pair ) === 'array' ) {
param_values[ decodeURIComponent( pair[0] ) ] = decodeURIComponent( pair[1] );
}
}
webAddress[ 'params' ] = param_values;
},
hash : function () { resourceAddress.params();
var fragment = window.location.hash.substring(1);
if ( fragment != '' && fragment != 'undefined')
webAddress[ 'hash' ] = fragment;
}
};
function typeOfVar (obj) {
return {}.toString.call(obj).split(' ')[1].slice(0, -1).toLowerCase();
}