Get help with testing, discuss unit testing strategies etc.


Post by Poojitha »

Hello Team,

Cross domain exception is encountered when webdriver is used to generate a report.
Command fired from cmd:
__SIESTA__\bin>webdriver https://localhost/__TEST_FILES_PATH__/index_record.html --report-format HTML --report-file foo.html
CMD Output:
throws exception "x-domain"
fail 1 - Test  threw an exception
Failed to access cross-origin page: https://TEST_PATH

In general tests should reside on the same domain as the app itself,
but you can try to disable web security:
https://www.bryntum.com/blog/testing-x-domain-websites-with-siesta-in-chrome/
[FAIL]  Policy.t.js
But, I have already disabled x-domain using the following link:
https://www.bryntum.com/blog/testing-x- ... in-chrome/

Also, the tests are pass when I exceute this the following commands:
> c:\CHROME_PATH>chrome.exe --disable-web-security --user-data-dir=c:\new_profile
> NEw Chrome browser opens
> Enter "https://localhost/__TEST_FILES_PATH__/index_record.html" path into the browser.
> Run the test.
> Test is successful.

Post by nickolay »

Hi,

When you use webdriver launcher, web security is enabled by default. You'll need to disable it explicitly with: --browser-arg disable-web-security

Then also the “Ignore X-Frame Headers” extension will not be installed in the Chrome profile, used by WebDriver. But this will only affect you if you test pages, which set X-Frame-Options to "SAMEORIGIN".

Post by Poojitha »

Thank you!

Post Reply