What parts of URL address do you know and what are they good for?
Experience Level: Junior
Tags: HTTP protocolQuality Assurance (QA)
Answer
As an example let's take the following URL:
https://www.bettercoder.io/JobInterviewQuestions/?q=My+query&a=112#lng=en-US
- Protocol - https (the part before ://)
- Thanks to protocol the HTTP client (browser) and the server know how to communicate, whether to use encrypted data transport or not
- Domain/Subdomain - www.bettercoder.io (the first part after ://)
- Thanks to the domain the HTTP client (browser) knows to which server it should connect.
- Path - /JobInterviewQuesions/ (the part between :// and ?)
- Thanks to the path the HTTP client (browser) knows what resource (web page) to ask for on the server
- Query string - ?q=My+query&a=112 (the part between ? and #)
- Query string gives the developer option to pass additional parameters in the URL (for example for filtering purposes)
- Hash portion - #lng=en-US (the part after #)
- Hash portion is used to navigate to the specific anchor in browser. It can also be used by front-end applications to route between pages.
Related Quality Assurance (QA) job interview questions
What is horizontal E2E testing?
Quality Assurance (QA) SeniorWhat test types are defined in the testing pyramid in levels from bottom to top?
Quality Assurance (QA) SeniorWhat are cookies and how are they used in HTTP protocol?
HTTP protocolQuality Assurance (QA) JuniorWhat is query string?
HTTP protocolQuality Assurance (QA) JuniorWhat is request payload?
HTTP protocolQuality Assurance (QA) Junior