askrobots / dbbasic Public

Model-config web apps: describe the app in configuration instead of writing code. Built on Polars and DuckDB.

0 downloads

dbbasic/tests/e2e/check_customers_page.py
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 Add DBBasic crate engine logo and update README 0d628db 1 year, 2 months ago History
check_customers_page.py · 1.6 KB · 52 lines
1#!/usr/bin/env python3
2
3from selenium import webdriver
4from selenium.webdriver.common.by import By
5from selenium.webdriver.chrome.options import Options
6import time
7
8# Setup Chrome options
9options = Options()
10options.add_argument('--headless')
11options.add_argument('--no-sandbox')
12options.add_argument('--disable-dev-shm-usage')
13
14driver = webdriver.Chrome(options=options)
15
16try:
17 # Load the customers page
18 driver.get("http://localhost:8005/customers")
19 time.sleep(2)
20
21 # Find all rows in the table
22 rows = driver.find_elements(By.CSS_SELECTOR, "tbody tr")
23 print(f"Found {len(rows)} customer rows")
24
25 # Check for Dan in the table
26 page_source = driver.page_source
27 if "Dan" in page_source:
28 print("✓ 'Dan' found on the page")
29 else:
30 print("✗ 'Dan' NOT found on the page")
31
32 # Look for pagination controls
33 pagination = driver.find_elements(By.CSS_SELECTOR, ".pagination, .page, button")
34 print(f"Found {len(pagination)} pagination-related elements")
35
36 # Print customer names visible on the page
37 print("\nCustomers visible on page:")
38 for row in rows:
39 try:
40 cells = row.find_elements(By.TAG_NAME, "td")
41 if len(cells) > 1:
42 print(f" - {cells[1].text}") # Name is usually in the second column
43 except:
44 pass
45
46 # Check if there's a way to show more records
47 selects = driver.find_elements(By.TAG_NAME, "select")
48 for select in selects:
49 print(f"\nFound select element: {select.get_attribute('outerHTML')[:100]}...")
50
51finally:
52 driver.quit()