workspace working
This commit is contained in:
32
test_option_text.py
Normal file
32
test_option_text.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
import time
|
||||
|
||||
options = webdriver.ChromeOptions()
|
||||
options.add_argument('--headless')
|
||||
options.add_argument('--no-sandbox')
|
||||
options.add_argument('--disable-dev-shm-usage')
|
||||
driver = webdriver.Chrome(options=options)
|
||||
driver.implicitly_wait(5)
|
||||
|
||||
try:
|
||||
driver.get('http://localhost:3015')
|
||||
time.sleep(3)
|
||||
combobox = driver.find_element(By.CSS_SELECTOR, '[role="combobox"].w-48')
|
||||
combobox.click()
|
||||
time.sleep(1)
|
||||
dropdown = driver.find_element(By.CSS_SELECTOR, '[role="listbox"][data-state="open"]')
|
||||
options = dropdown.find_elements(By.CSS_SELECTOR, '[role="option"]')
|
||||
for i, opt in enumerate(options):
|
||||
print(f'Option {i}: text="{opt.text}"')
|
||||
# find all spans
|
||||
spans = opt.find_elements(By.TAG_NAME, 'span')
|
||||
for j, sp in enumerate(spans):
|
||||
print(f' span {j}: text="{sp.text}" id={sp.get_attribute("id")}')
|
||||
driver.save_screenshot('options.png')
|
||||
except Exception as e:
|
||||
print('Error:', e)
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
driver.quit()
|
||||
Reference in New Issue
Block a user