Commit 94ce8021 authored by Xiang Ji's avatar Xiang Ji Committed by Commit Bot

Update extension policy tests with the CWS button change

Bug: 1124114

Validation: https://ci.chromium.org/p/chromium/builders/try/win-celab-try-rel/140?
Change-Id: Idc984c1fb038d4d2f4c26db62bb0cd9f540d233f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389227
Commit-Queue: Xiang Ji <jxiang@google.com>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804277}
parent 0be3ba94
...@@ -6,6 +6,7 @@ import time ...@@ -6,6 +6,7 @@ import time
from absl import app, flags from absl import app, flags
from selenium import webdriver from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from pywinauto.application import Application from pywinauto.application import Application
from pywinauto.findwindows import ElementNotFoundError from pywinauto.findwindows import ElementNotFoundError
...@@ -22,20 +23,21 @@ def main(argv): ...@@ -22,20 +23,21 @@ def main(argv):
#Always set useAutomationExtension as false to avoid failing launch Chrome #Always set useAutomationExtension as false to avoid failing launch Chrome
#https://bugs.chromium.org/p/chromedriver/issues/detail?id=2930 #https://bugs.chromium.org/p/chromedriver/issues/detail?id=2930
chrome_options.add_experimental_option("useAutomationExtension", False) chrome_options.add_experimental_option("useAutomationExtension", False)
driver = test_util.create_chrome_webdriver(chrome_options=chrome_options) driver = test_util.create_chrome_webdriver(chrome_options=chrome_options)
app = Application(backend="uia") app = Application(backend="uia")
app.connect(title_re='.*Chrome|.*Chromium') app.connect(title_re='.*Chrome|.*Chromium')
driver.get(FLAGS.url) driver.get(FLAGS.url)
time.sleep(5) time.sleep(5)
driver.find_element_by_xpath("//div[@aria-label='Add to Chrome']").click()
try: try:
driver.find_element_by_xpath(
"//div[@aria-label='Blocked by admin']").click()
app.top_window() \ app.top_window() \
.child_window(title_re='.*Your admin has blocked', control_type="TitleBar") \ .child_window(title_re='.*Your admin has blocked', control_type="TitleBar") \
.print_control_identifiers() .print_control_identifiers()
except ElementNotFoundError as error: except NoSuchElementException:
print("Not blocked")
except ElementNotFoundError:
print("Not blocked") print("Not blocked")
finally: finally:
driver.quit() driver.quit()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment