Код: Выделить всё
about:preferences#privacy
При этом я столкнулся с проблемой при поиске по By.XPATH и By.ID. Рассмотрим следующий HTML:
Код: Выделить всё
Код: Выделить всё
driver = webdriver.Remote (
command_executor = SELENIUM_GRID_HUB + '/wd/hub',
options = opts)
driver.set_window_size (1280, 1024)
wait = WebDriverWait (driver, 10)
current_window_handle = driver.current_window_handle
driver.execute_script ("window.open('');")
wait.until (EC.number_of_windows_to_be (2))
for handle in driver.window_handles:
if handle != current_window_handle:
driver.switch_to.window (handle)
break
driver.get ('about:preferences#privacy')
wait.until (EC.element_to_be_clickable (
(By.ID, 'clearSiteDataButton'))).click ()
t = wait.until (EC.presence_of_element_located (
(By.ID, "dialogStack")))
print('00', t.get_attribute('outerHTML'))
print ('01', wait.until (EC.presence_of_all_elements_located (
(By.ID, "dialogTemplate"))))
print ('02', wait.until (EC.presence_of_all_elements_located (
(By.XPATH, "//vbox[@id='dialogTemplate']"))))
Код: Выделить всё
01 [, , ]
Подробнее здесь: https://stackoverflow.com/questions/798 ... n-selenium
Мобильная версия