Bettymk
Bettymk

Reputation: 21

How to select an option from notification prompt in browsers using robot framework

Is there a way to choose an option from popup notifications (E.g. for location, password, translation etc.) that appear in the browsers by using robot framework?

Image 1:

enter image description here

Image 2:

enter image description here

Image 3:

enter image description here

Image 4:

enter image description here

Upvotes: 0

Views: 1177

Answers (2)

Suresh
Suresh

Reputation: 11

Try selenium library-Handle alert Keyword. It will be helpful in handling all pop up related tasks.

http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Handle%20Alert

ACCEPT: Accept the alert i.e. press Ok. Default. DISMISS: Dismiss the alert i.e. press Cancel. LEAVE: Leave the alert open.

Eg:

Handle Alert action=ACCEPT

Upvotes: 0

Yash Jagdale
Yash Jagdale

Reputation: 1508

1. For Location pop up :- for such cases you need to enable or disable location access through desire capabilities of browser. for example in case of location access you need to set "disable-geolocation" in your chrome options, similarly you need to set

FirefoxProfile geoDisabled = new FirefoxProfile();
geoDisabled.setPreference("geo.enabled", false);
geoDisabled.setPreference("geo.provider.use_corelocation", false);
geoDisabled.setPreference("geo.prompt.testing", false);
geoDisabled.setPreference("geo.prompt.testing.allow", false

2. For Password save popup:- For this you need to set Experimental option in chrome by setting "credentials_enable_service" and "profile.password_manager_enabled" as false.

Example:-

${list} =     Create List    --disable-geolocation      --start-maximized      --profile.password_manager_enabled=false       --credentials_enable_service=false
${args} =     Create Dictionary    args=${list}
${desired caps} =     Create Dictionary    platform=${OS}     chromeOptions=${args}
Open Browser    https://www.google.com    remote_url=${grid_url}    browser=${BROWSER}    desired_capabilities=${desired caps}

Upvotes: 1

Related Questions