Same Origin Security Policy
Overview
All modern JavaScript browsers enforce the Same Origin Security Policy. The same origin policy states that JavaScript is only allowed to read/modify HTML from the same origin as its JavaScript source.
What is Origin?
Let’s first understand the origin of the website content. Origin is defined by the protocol scheme, domain name( or the hostname), and the communication port of the URL.
http://example.com:8080/
- protocol -> http
- domain name -> example.com
- port -> 8080
For example, the below have the same origin.
- http://example.com:8080/index.html
- http://example.com:8080/scripts/sample.js
The same origin policy creates a problem for JavaScript tests. For example, If we write a JavaScript (.js ) file designed to test functionality on the example.com domain, to comply with the policy we need to install that .js file on the example.com domain in order to write automated tests for that domain.
—
Selenium Tutorials
Selenium Tutorials on this website can be found at:
https://www.testingdocs.com/selenium-webdriver-tutorial
For more details on the Selenium, visit the official website at: