我运行这段代码
#Gets to the Calendar for the week with the Login Details
calendar = driver.get('https://www.investing.com/economic-calendar/')
time.sleep(5)
driver.find_element_by_xpath('/html/body/div[9]/div[3]')
driver.find_element_by_xpath('//*[@id="onetrust-accept-btn-handler"]').click()
time.sleep(5)
driver.find_element_by_xpath('/html/body/div[10]/div')
driver.find_element_by_xpath('/html/body/div[10]/div/div[4]/button[1]').click()
有时我成功有时我得到错误
ElementClickInterceptedException: element click intercepted: Element <a onclick="overlay.overlayLogin();" href="javascript:void(0);" class="login bold">...</a> is not clickable at point (821, 19). Other element would receive the click: <div class="allow-notifications-popup-wrapper shown">...</div>
(Session info: chrome=84.0.4147.135)
因为顽皮的弹出窗口/警报并不总是出现。
我怎样才能写一个如果(弹出在那里)然后点击它
或者
IF pop-not有跳过下面两行吗?
谢谢
HUH函数
胡说叔叔
Helenr
相关分类