Bug 225050 - Safari preferences for setting Pop-up Windows not working in Selenium tests with Webdriver
Summary: Safari preferences for setting Pop-up Windows not working in Selenium tests w...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: Other
Hardware: Unspecified Other
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-26 06:47 PDT by harshit
Modified: 2021-05-03 06:48 PDT (History)
2 users (show)

See Also:


Attachments
GIF showing the bug inside locally executed selenium through webdriver in which pop-up functionality is tested. (750.07 KB, image/gif)
2021-04-26 06:47 PDT, harshit
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description harshit 2021-04-26 06:47:18 PDT
Created attachment 427039 [details]
GIF showing the bug inside locally executed selenium through webdriver in which pop-up functionality is tested.

Browsers: Safari 12.1, 13.1 and 14

Safari provides pop-up windows preferences to be set to three modes. "Block", "Block and Notify" and "Allow". These preferences work when running in a normal Safari session. However, on running selenium tests with webdriver the settings are not honoured and the default behavior is set to always allow popups even when set to "Block" or "Block and Notify".
Note: when the running selenium session is stopped manually by interfering through mouse click, even after stopped session the same behavior is observed wherein pop-up preference is not being honored even on manually testing popup feature.
Comment 1 harshit 2021-04-28 04:20:40 PDT
Attaching sample script to reproduce the issue herein. To change safari preferences 
1. Open safari Browser
2. Go to preferences
3. Go to Pop-up Windows
4. Select one of the three modes given next to "When visiting other websites"

import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import ActionChains

driver = webdriver.Safari()

driver.get("https://deliver.courseavenue.com/PopupTest.aspx")
element = driver.find_element_by_css_selector('#ctl00_ContentMain_popupTest')
action = ActionChains(driver)
action.click(element).perform()
time.sleep(10)
driver.quit()
Comment 2 Radar WebKit Bug Importer 2021-05-03 06:48:14 PDT
<rdar://problem/77453163>