Practical Solution - QA 24-25
Practical Solution - QA 24-25
1. Searching a Number
def search(arr,n,k):
if arr[i] == k;
return i+1
return -1
N=5
K = 16
Arr = {9,7,2,16,4}
print(result)
2. Balanced Array
def minValueToBalance(arr,n);
left_sum = sum(arr[n//2])
N=4
arr = [1,5,3,2]
result = minValueToBalance(arr,N)
print(result) #The Output will be 1, when you use both left_sum and right_sum....!
3. Test Case for Login Page
import time
def test_valid_login():
email.send_keys("[email protected]"
password.send_keys("password123!")
login_button.click()
time.sleep(2)
def test_invalid_email():
password = driver.find_element(By.ID,"password)
time.sleep(2)
password = driver.find_element(By.ID,"password)
email.clear()
email.send_keys([email protected])
password.clear()
password.send_keys("123")
login_button.click()
time sleep(2)
errror_message = driver.find_element(By.CLASS_NAME,"error-message")
try:
test_valid_login()
test_invalid_email()
test_short_password()
finally:
driver.quit()
Thank you so much...........