use xpath for bans page test

This commit is contained in:
Jordan Blasenhauer 2024-03-01 17:39:50 +01:00
parent 4cba247f49
commit 8c8a2e51b0
2 changed files with 3 additions and 11 deletions

View file

@ -95,16 +95,8 @@ try:
log_info("Bans found, trying to delete them ...")
delete_ban_checkbox = safe_get_element(DRIVER, By.XPATH, "//input[@id='ban-item-2']")
assert isinstance(delete_ban_checkbox, WebElement), "Delete checkbox is not WebElement"
DRIVER.execute_script("arguments[0].click()", delete_ban_checkbox)
unban_button = safe_get_element(DRIVER, By.XPATH, "//button[@data-unban-btn='']")
assert isinstance(unban_button, WebElement), "Delete button is not WebElement"
DRIVER.execute_script("arguments[0].click()", unban_button)
refresh = safe_get_element(DRIVER, By.XPATH, "//button[@data-unban-btn='']", 5)
assert_button_click(DRIVER, "//input[@id='ban-item-2']")
access_page(DRIVER, "//button[@data-unban-btn='']", "bans", False)
try:
entries = safe_get_element(DRIVER, By.XPATH, "//ul[@data-bans-list='']/li", multiple=True, error=True)

View file

@ -139,11 +139,11 @@ def access_page(driver, button: Union[str, WebElement], name: str, message: bool
if message:
log_info(f"{name.title()} page loaded successfully")
driver.set_window_size(2560, 1440)
log_info("Try update window size to 2560,1440")
log_info("Current window size is: " + str(driver.get_window_size()))
def wait_for_service(service: str = "www.example.com"):
ready = False
retries = 0