Issue
I wrote this code for disable pop up window:
chrome_options = Options()
chrome_options.add_argument("--disable-popup-blocking")
driver = webdriver.Chrome(options=chrome_options)
url="https://www.fluidmeet.com/search/Dubai/office-spaces"
driver.get(url)
But it's not working! This picture show that pop up window:
Solution
This code wouldn't do anything with element pop-up in DOM.
In your case pop-up is rendered on load in DOM (no Chrome option can disable it) and after some time it receives class 'show-flex', so it becomes visible for you at random time that defined by site logic / your actions.
Dealing with such pop-up is some kind of reverse engineering and specific for every case.
As a general suggestion, I suggest to find for element pop-up and remove it from DOM after load, using native JS remove
function.
In current case your popup unique selector is element that has classes more-filter fz-17 justify-content-center
and has child element .popup-send-requests
.
driver.get('https://www.fluidmeet.com/search/Dubai/office-spaces')
driver.maximize_window()
driver.execute_script("""
let elements = document.querySelectorAll("[class*='more-filter fz-17 justify-content-center']");
elements.forEach(element => {
if (!!element.querySelector('.popup-send-requests')) {
element.remove();
console.log('Removed');
}
});
""")
search = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#srch-btn")))
Answered By - Yaroslavm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.