In [22]:
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
In [23]:
driver.get('https://survival8.blogspot.com/2022/11/lcm-of-two-numbers.html')
In [24]:
customA = driver.find_element("id", "customA")
customB = driver.find_element("id", "customB")
In [28]:
customA.clear()
customB.clear()
customA.send_keys("12")
customB.send_keys("4")
In [29]:
customButton = driver.find_element("id", "customButton")
In [30]:
customButton.click()
In [31]:
customAnswer = driver.find_element("id", "customAnswer")
In [32]:
int(customAnswer.text)
Out[32]:
12
In [33]:
test_cases = [
{
"A": 12,
"B": 4,
"Ans": 12
},
{
"A": 48,
"B": 12,
"Ans": 48
},
{
"A": 98,
"B": 7,
"Ans": 98
},
{
"A": 1,
"B": 2,
"Ans": 3
}
]
In [34]:
for i in test_cases:
customA.clear()
customB.clear()
customA.send_keys(i["A"])
customB.send_keys(i["B"])
customButton.click()
if(int(customAnswer.text) == i['Ans']):
print("Pass")
else:
print("Fail")
print(i)
Pass Pass Pass Fail {'A': 1, 'B': 2, 'Ans': 3}
In [ ]:
No comments:
Post a Comment