0

I am running my test in Visual Studio 10, with C# and Selenium. There is a moment that Im landing on a page and I need to check some elements of the page, but its like "loading" continuously so its impossible to find this elements, cause are changing. The only way to find them is in Chrome Settings, Disable JavaScript and perfect it works. But how I disable Javascript with selenium in the same page, without call a new one? Just refreshing or smthg. Thx!!!

ElBandido

1
  • The page doesn't stop loading - so that's a bug? Commented Jan 27, 2015 at 13:29

1 Answer 1

0

You can set that to profiler. Handling would be different based on how you want to do it

var firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("javascript.enabled", false);

See this

For Chrome

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.switches", Arrays.asList("--disable-javascript"));

Taken from here

Sign up to request clarification or add additional context in comments.

3 Comments

Saifur thanks for your reply, but I said in Chrome, I was googling for few hours before ask, no see any way to do it in Chrome once opened the browser. Thanks anyway!
He asked for it to be in C# not JS
@LukeRayner not sure what you meant. My code is In Java But, this can easily be converted to any language

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.