Add files via upload

This commit is contained in:
David Rotermund 2023-05-13 21:25:27 +02:00 committed by GitHub
parent 09d2c6bee4
commit 6af89e8f92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,5 @@
{
"wizard_button": "Toggle Drag In Wizard",
"wizard_button_close": "t3js-modal-close close",
"wizard_open": "new-element-drag-in-wizard"
}

View file

@ -0,0 +1,45 @@
import json
import os
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
def press_wizzard_button(driver: webdriver.firefox.webdriver.WebDriver):
string_json_path: str = os.path.join("content", "press_wizzard_button.json")
with open(string_json_path, "r") as file:
string_dict = json.load(file)
wizard_open: bool = False
found_element_list = driver.find_elements(By.TAG_NAME, "div")
for i in found_element_list:
if str(i.get_dom_attribute("id")) == string_dict["wizard_open"]:
wizard_open = True
break
while wizard_open is False:
found_element_list = driver.find_elements(By.TAG_NAME, "a")
for i in found_element_list:
temp_str = str(i.get_dom_attribute("title"))
if temp_str.find(string_dict["wizard_button"]) != -1:
i.click()
break
time.sleep(2)
found_element_list = ["not empty"] # type: ignore
while len(found_element_list) > 0:
found_element_list = driver.find_elements(By.TAG_NAME, "button")
for i in found_element_list:
temp_str = str(i.get_dom_attribute("class"))
if temp_str.find(string_dict["wizard_button_close"]) != -1:
i.click()
break
time.sleep(1)
found_element_list = driver.find_elements(By.TAG_NAME, "div")
for i in found_element_list:
if str(i.get_dom_attribute("id")) == string_dict["wizard_open"]:
wizard_open = True
break