- , , . , script .
, , API , , , , , , , . " script , , .
, , . , , , AngularJS API React API ..
1.
Selenium includes WebDriverWaitand expected_conditionsto help you wait until the special conditions are met:
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
TIMEOUT = 5
WebDriverWait(driver, TIMEOUT).until(
EC.text_to_be_present_in_element(
[By.CLASS_NAME, "alert"],
"Record created successfully"))
2. Using Capybara (which uses Selenium)
As you can see above, bare selenium is complex and subtle. capybara-py tears most of it off:
from capybara.dsl import page
page.assert_text("Record created successfully")
source
share