Skip to content Skip to navigation
Check Our New Demo Website!
Home >> Taxonomy >> Term >> Selenium

Selenium

Defining Firefox Profile preferences using Selenium Webdriver

Some times, you may need to update the preferences within Firefox. We can do this by instantiating a Firefox Profile object and then update the settings.

We will then need to pass this object into FirefoxDriver which will load the profile with your defined settings.

You can check them using command "about:config" in the borwser. It will display a warning message and then asks you to proceed if required. Becarefull when doing any changes.

How to handle javascript alerts, confirmation and prompts?

Generally JavaScript popups are generated by web application and hence they can be easily controlled by the browser.

Webdriver offers the ability to cope with javascript alerts using Alerts APIClick here to view Alert API Details

// Get a handle to the open alert, prompt or confirmation
Alert alert = driver.switchTo().alert();

Alert is an interface. There below are the methods that are used

//Will Click on OK button.
alert.accept();

Subscribe to RSS - Selenium