Currently, I am familiarizing myself with Protractor as the tool for automating website testing. Specifically, I am running tests on the following page: , using Google Chrome browser.
The issue at hand is:
1. Protractor successfully navigates to .
2. Manually accessing by pasting the URL in the browser works fine.
3. When Protractor first goes to and then clicks on "AngularJS Developers" in the BROWSE TOP SKILLS section, it functions correctly.
4. However, if Protractor attempts to directly access using browser.get(url), it fails to load and instead displays the message:
"Access to this web page is denied.
Please ensure that your browser supports JavaScript and cookies and that they are not being blocked. For more information on Upwork's cookie usage, refer to our Cookie Policy."
https://i.sstatic.net/44vZD.png
To keep the test independent, I have created two classes for testing purposes - one for testing the HomePage and another for testing the HirePage. This decision led me to attempt opening the browser directly on in order to avoid having to navigate through the HomePage. The goal is to eliminate dependency between the tests since if the first test fails, so will the second. How can I address this issue?
Below is the code snippet for the HirePage Test:
const HirePage = require("../Pages/HirePage");
let hirePage;
const url = browser.params.HirePageURL;
const expectedHeadLine = browser.params.expectedHeadlineOnHirePage;
beforeAll(function () {
browser.get(url);
hirePage = new HirePage();
});
describe("Checks Hire page and filters freelancers after submitting data", function () {
it("Should display the correct Headline", function () {
expect(hirePage.headlineUpperText()).toContain(expectedHeadLine);
});
});
Additionally, here is my cong.js file for reference:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
browserName: 'chrome',
// 'chromeOptions': { 'args': ['incognito'] }
},
onPrepare: function() {
browser.driver.manage().window().maximize();
browser.manage().timeouts().implicitlyWait(5000);
browser.manage().timeouts().pageLoadTimeout(10000);
},
specs: [
// './*/HomePageTest-spec.js',
'./*/HirePageTest-spec.js',
],
params: require('./Configuration/configurationFile')
};
To execute the test, I simply type "protractor conf.js" into the console.
Following advice provided by Yong in the responses, here is a screenshot documenting the process: https://i.sstatic.net/AqhEc.png