1

I am currently trying to write a test that tests the non-JS version of my website. I use Selenium with Java. I have tried this:

 FirefoxProfile profile = new FirefoxProfile();
 profile.setPreference("javascript.enabled", false);
 driver = new FirefoxDriver(profile);
 driver.get();

However this isn't working. It just loads the page with JavaScript Enabled.

1 Answer 1

1

As a workaround I did, this, for the requirement.
It will manually set the javascript.enabled property to false by the following script.

    WebDriver driver = new FirefoxDriver();
    driver.get("about:config");
    Actions act = new Actions(driver);
    act.sendKeys(Keys.RETURN).sendKeys("javascript.enabled").perform();
    act.sendKeys(Keys.TAB).sendKeys(Keys.RETURN).perform();
Sign up to request clarification or add additional context in comments.

2 Comments

Everything is theoretically impossible, until it is done
Sure! Will give it a shot today

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.