kalps - think-1st.com
kalps - think-1st.com

Reputation: 166

Selenium - Block popup using firefox driver

I want to block popup in selenium using firefox driver.

has anyone done anything like this? i have had tried by loading extension but no success.

Can anyone help here?

Thanks!

Regards, Kalpesh Patel

Upvotes: 0

Views: 1287

Answers (1)

Minal K Sinha
Minal K Sinha

Reputation: 424

You need to use your browser profile and block popup there. Pass your profile as a parameter while creating instance of your browser. check the code below:

ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("Your-profile-name");
profile.setPreference( "intl.accept_languages", "no,en-us,en" ); 
FirefoxDriver driver = new FirefoxDriver(profile);
driver.get("http://www.example.com/");

Note: I consider that you already know the concept of profile in browser.

Upvotes: 1

Related Questions