开发者

how to handle cross-domain testing in selenium

开发者 https://www.devze.com 2023-02-08 14:32 出处:网络
How to handle cross-domain funct开发者_JAVA百科ionality in selenium.can any one explain me plz? For ex: need to open Google.com and gmail, Using same selenium session object, I was seeing permission

How to handle cross-domain funct开发者_JAVA百科ionality in selenium.can any one explain me plz?

For ex: need to open Google.com and gmail, Using same selenium session object, I was seeing permission denied error , i tried with *iehta, Proxy injection mode as well it didn't work can you help me out..


I found this anwer on stackexchange.com:

You should be able to do so while using browsers with elevated security privileges like *chrome for firefox. So you could just do

selenium.open("newURL");

in your test. Problem of changing URL is, it change in domain and normal Selenium browser mode is restricted by Java Script's Same Origin Policy, as I mentioned above browsers with elevated security privileges should get you going.

I suppose this is the point where you are trying to load another URL in same selenium session -

sel.open("www.google.com");
sel.waitForPageToLoad(stimeout);

First - don't use waitForPageToLoad, open api takes care of it. Now if sel.open does not work then you should definitely encounter error. Don't keep you method in try catch block and see the error you encounter....

1: https://sqa.stackexchange.com/questions/761/can-the-base-url-be-changed-in-the-same-browser-session-using-selenium-rc


If can't open two different domains with one selenium object, try using a different object for each domain (e.g. an object called seleniumGoogle and an object calledseleniumGmail).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号