-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassertions_exercise_2.py
More file actions
46 lines (31 loc) · 1.31 KB
/
assertions_exercise_2.py
File metadata and controls
46 lines (31 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(5)
driver.get("https://bank-api--ahimalka89.replit.app/")
deposit_amount = 50000
deposit = driver.find_element(By.XPATH, "//input[@type = 'number']")
deposit.send_keys(deposit_amount)
button = driver.find_element (By.XPATH, "//button[text()= 'Confirm Deposit']")
button.click()
print(f"💲 Deposit of ${deposit_amount} submitted successfully.")
button = driver.find_element (By.XPATH, "//button[text()= 'Withdraw']")
button.click()
time.sleep(1)
withdraw_amount = 5000
withdraw = driver.find_element(By.XPATH, "//input[@type = 'number']")
withdraw.send_keys(withdraw_amount)
button = driver.find_element (By.XPATH, "//button[text()= 'Confirm Withdrawal']")
button.click()
print(f"💲 Withdrawal of ${withdraw_amount} submitted successfully.")
time.sleep(2)
assert_Recent_Activity = driver.find_element (By.XPATH, "//div[contains(@class, 'custom-scrollbar')]").text
driver.save_screenshot ("deposit_withdraw.png")
assert "5,000" in assert_Recent_Activity
assert "50,000" in assert_Recent_Activity
print("💲 Data verification passed: Transactions appear correctly in Recent Activity!")
time.sleep(2)
driver.quit()