2 years ago
#32397
Krupal Vaghasiya
Returning wrong data from Excel while reading data using openpyxl
I have created an excel file for managing data for my test. When the script is run, it will create a patient, and write the patient name and last name into an excel file.
Then I have used that patient for my order creation. At this point, the script is working fine. But after order creation, I want to search patients, and for that, when I read data from an excel file, it should send the data used when the script was run last time.
Please check this video for more clarification here
It will create an order using a new patient, but when I search for a patient, it should catch old data from an excel file.
When I run a single test, it will work. But when I run all tests together, it will return old data. Please check video here
FilePath = "C:/Users/Administrator/PycharmProject/LegrandePython/TestData/Data.xlsx"
datafile = load_workbook(FilePath, data_only=True)
testData = datafile['Test Data']
This works fine when I create an order for the created patient.
PatientSearch.send_keys(testData.cell(2, 1).value)
But when I try to search for patients, it should send the old data from the excel sheet.
self.driver = setup
self.driver.find_element_by_css_selector(DispenserLocators.patientSearch).send_keys(testData.cell(2, 1).value)
python
excel
selenium
openpyxl
data-driven-tests
0 Answers
Your Answer