report.html

Report generated on 24-Jan-2023 at 19:19:17 by pytest-html v2.1.1

Environment

Packages {"pluggy": "0.13.1", "py": "1.9.0", "pytest": "6.1.0"}
Platform Windows-10-10.0.19041-SP0
Plugins {"allure-pytest": "2.8.18", "datadir": "1.3.1", "html": "2.1.1", "metadata": "1.10.0"}
Python 3.8.5

Summary

63 tests ran in 6617.77 seconds.

7 passed, 0 skipped, 56 failed, 0 errors, 0 expected failures, 0 unexpected passes

Results

Result Test Duration Links
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[A] 134.72
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7EEA5700>, value = 'A', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[C] 123.60
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F15BEB0>, value = 'C', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[D] 123.29
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F24F190>, value = 'D', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[E] 123.50
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F030790>, value = 'E', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[F] 134.17
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F24FFD0>, value = 'F', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[H] 123.59
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F1D8C70>, value = 'H', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[I] 123.46
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F0F5D90>, value = 'I', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[J] 123.36
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F0F0C10>, value = 'J', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[K] 135.12
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F104100>, value = 'K', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[M] 123.10
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F36DF70>, value = 'M', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[N] 123.37
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F2B5370>, value = 'N', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[O] 123.51
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F3658E0>, value = 'O', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[P] 134.88
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F2BFEB0>, value = 'P', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[R] 123.50
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F42CF70>, value = 'R', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[S] 123.27
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F45F760>, value = 'S', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[T] 123.38
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F3FAA60>, value = 'T', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[U] 134.78
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F2F7100>, value = 'U', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[W] 123.88
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F300E80>, value = 'W', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[X] 123.32
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F3A49D0>, value = 'X', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[Y] 123.37
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F215430>, value = 'Y', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[Z] 133.74
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F50BC70>, value = 'Z', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AB] 123.06
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F58B700>, value = 'AB', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AC] 122.81
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F4A7490>, value = 'AC', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AD] 123.55
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F549F10>, value = 'AD', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AE] 134.89
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F283250>, value = 'AE', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/agile-and-scrum-certification-training INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AG] 123.83
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F675820>, value = 'AG', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cisa-certification-training INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AH] 123.65
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F680280>, value = 'AH', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/cyber-security/cissp-certification-training INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AI] 123.42
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowCertificationProgram object at 0x0000019E7F497640>, value = 'AI', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0000","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", certification_program_course_read_csv())
def test_Orders_and_Payment_Flow_certification(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
url_count = self._count_url_txt_file_subdomain('Orders_and_Payment_Flow_Certification.txt')
logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_certification_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['common_button_enroll_now_certificaton'],10):
course_data = None
self.pg_orders.click_enroll_now_for_masters(url_value)
course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_certification(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Certification Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'Certification Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][1],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:136: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/big-data-and-analytics/big-data-and-hadoop-training INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:114 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 72, in test_Orders_and_Payment_Flow_certification self.pg_orders.click_enroll_now_for_masters(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 156, in click_enroll_now_for_masters self.btn_enroll_now_masters_program.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: btn_enroll_now_masters_program
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[A] 82.22
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F4BC250>, value = 'A', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[B] 82.52
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F6ACBB0>, value = 'B', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[C] 84.01
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F6A6AF0>, value = 'C', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[D] 72.68
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F66B940>, value = 'D', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: IN ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[E] 82.42
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F5C1C10>, value = 'E', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[F] 82.10
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F5D2EB0>, value = 'F', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[G] 81.85
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F739FA0>, value = 'G', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[H] 73.19
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F3C8FA0>, value = 'H', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: US ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[I] 82.41
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F74C0A0>, value = 'I', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[J] 82.06
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F3C8FD0>, value = 'J', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[K] 82.08
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F7A05B0>, value = 'K', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[L] 72.81
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F7C6A00>, value = 'L', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: GB ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[M] 82.31
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F8E5220>, value = 'M', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[N] 82.09
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F6CF370>, value = 'N', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[O] 82.33
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F8E51F0>, value = 'O', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[P] 73.22
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F72EEB0>, value = 'P', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: AU ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[Q] 82.47
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F6F46A0>, value = 'Q', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[R] 82.22
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F7DD5B0>, value = 'R', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[S] 82.07
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F6F4DC0>, value = 'S', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[T] 73.59
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F7DDEE0>, value = 'T', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: DE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[U] 82.04
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F93E5E0>, value = 'U', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[V] 82.10
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F984400>, value = 'V', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[W] 82.58
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F99BF10>, value = 'W', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: SG ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[X] 72.77
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F9CCB80>, value = 'X', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[Y] 82.18
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F9CCE50>, value = 'Y', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/full-stack-web-developer-mean-stack-certification-training INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[Z] 82.38
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7F9E12E0>, value = 'Z', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/automation-testing-masters-program-certification-training-course INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[AA] 82.39
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7FAE7AF0>, value = 'AA', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/ui-ux-design-masters-program-certification-course INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Failed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowMastersProgram::test_Orders_and_Payment_Flow_masters_program[AB] 72.43
self = <test_orders_and_payment_flow.TestOrderAndPaymentFlowMastersProgram object at 0x0000019E7FAE7BE0>, value = 'AB', initialize_pages = None
testdata = {'contact_no': '123456789', 'country': ['in', 'us', 'gb', 'au', 'de', 'sg', ...], 'db_type': 'mysql', 'dynamo_db_type': 'dynamo', ...}

@pytest.mark.test_details("0001","high","Order and Payment Flow","Pradeep")
@pytest.mark.parametrize("value", master_program_course_read_csv())
def test_Orders_and_Payment_Flow_masters_program(self,value,initialize_pages,testdata):

'''
Objective: Make payment and validate the data in Dynamo db and mySql

Step 01: get url
Step 02: click on Enroll Now CTA
Step 03: Make payment
Step 04: Validate the Dynamo db and MySql daya for the payment
'''
# self.add_rows_in_csv('Report.csv') this step is commentd to make one CSV file
# self.add_rows_in_csv('Report.csv')
#url_count = self._count_url_txt_file_subdomain('Order_and_Payment_Flow_masters.txt')
#logging.info(f"Total URL Present is: {url_count}")

# Step 01: get url
counter = 0
df = pd.read_csv('order_and_payment_master_prod.csv', on_bad_lines='skip')
data = df[df['id']==value]
url_value = data['url'].values[0]
country_value = data['country'].values[0]
try:
pytest.driver.delete_all_cookies()
pytest.driver.get(url_value)
logging.info(f"Url Opened is: {url_value}")
selenium_helper.wait_for_page_to_load(10,value)
self.pg_orders.change_country(country_value)

if selenium_helper.is_locator_present(self.pg_orders.locators['btn_enroll_now_masters_program'],10):
course_data = None
self.pg_orders.click_enroll_now_certification(url_value)

course_data = self._complete_payment(country_value,testdata['payment_type'],testdata['name'],testdata['email_id'],testdata['contact_no'])
logging.info(type(course_data))
time.sleep(5)

logging.info(f"course_data: {course_data}")

# Step 04: Validate the Dynamo db and MySql data for the payment
token_no = pytest.driver.current_url.split('authtoken=')[-1]
logging.info(f"Token No is: {token_no}")
query = testdata['sql_query'].replace('<token_no>',token_no)

sql_data = db_helper.get_prod_data(query,testdata['db_type'])
logging.info(f"RAW SQL Data: {sql_data}\n")
sql_items = self.convert_items_to_json(sql_data)
logging.info(f"SQL DATA in JSON format: {sql_items}\n")

message = self.verify_mySQL_data_masters_program(course_data[0],sql_items,sql_data,testdata)
if 'successfull' in message[0].lower():
status = 'Success'
else:
status = 'Fail'
filename = 'Report.csv'
course_name = course_data[0]['course_name']
course_type = 'Masters Program'
# course_type = sql_items['training_type_txt']
rows = [[country_value.upper(),course_name,course_type,url_value,message,course_data[1][0],course_data[1][1],status]]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

else:
message = "Enroll Now button is not Appearing"
logging.info(message)
filename = 'Report.csv'
course_name = self.pg_orders.course_name_in_url.get_text()
course_type = 'Masters Program'
rows = [[country_value.upper(),course_name,course_type,url_value,message,'','','CTA NOT AVAILABLE']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)

except Exception as e:
counter = counter+1
logging.error("Exception occurred", exc_info=True)
filename = 'Report.csv'
course_name = 'NA'
course_type = 'master Program'
if course_data == None:
rows = [[country_value.upper(),course_name,course_type,url_value,'','','','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 1:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[0],'','Fail']]
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)
elif len(course_data) == 2:
rows = [[country_value.upper(),course_name,course_type,url_value,'',course_data[1][0],course_data[1][0]],'Fail']
with open(filename, 'a', newline='\n') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerows(rows)


if counter != 0:
> pytest.fail('Failed')
E Failed: Failed

test_prod\test_orders_and_payment_flow.py:451: Failed
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:378 Url Opened is: https://www.simplilearn.com/advanced-digital-marketing-certification-training-course INFO  setup:orders_page.py:30 Country Set to: AE ERROR  setup:test_orders_and_payment_flow.py:429 Exception occurred Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 384, in test_Orders_and_Payment_Flow_masters_program self.pg_orders.click_enroll_now_certification(url_value) File "C:\test_repos\pre_sales_test_python\pages_prod\orders_page.py", line 35, in click_enroll_now_certification self.common_button_enroll_now_certificaton.scroll_to_element() File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: common_button_enroll_now_certificaton
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[B] 94.20
------------------------------Captured stderr call------------------------------
--- Logging error --- Traceback (most recent call last): File "c:\users\qateam\appdata\local\programs\python\python38\lib\logging\__init__.py", line 1084, in emit stream.write(msg + self.terminator) File "c:\users\qateam\appdata\local\programs\python\python38\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u20b9' in position 136: character maps to <undefined> Call stack: File "c:\users\qateam\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\qateam\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\qateam\AppData\Local\Programs\Python\Python38\Scripts\pytest.exe\__main__.py", line 7, in <module> sys.exit(console_main()) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 187, in console_main code = main() File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 164, in main ret = config.hook.pytest_cmdline_main( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 306, in pytest_cmdline_main return wrap_session(config, _main) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 257, in wrap_session session.exitstatus = doit(config, session) or 0 File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 313, in _main config.hook.pytest_runtestloop(session=session) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\main.py", line 338, in pytest_runtestloop item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 110, in pytest_runtest_protocol runtestprotocol(item, nextitem=nextitem) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 127, in runtestprotocol reports.append(call_and_report(item, "call", log)) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 216, in call_and_report call = call_runtest_hook(item, when, **kwds) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 255, in call_runtest_hook return CallInfo.from_call( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 310, in from_call result = func() # type: Optional[TResult] File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 256, in <lambda> lambda: ihook(item=item, **kwds), when=when, reraise=reraise File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\runner.py", line 163, in pytest_runtest_call item.runtest() File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\python.py", line 1627, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__ return self._hookexec(self, self.get_hookimpls(), kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "c:\users\qateam\appdata\local\programs\python\python38\lib\site-packages\_pytest\python.py", line 184, in pytest_pyfunc_call result = testfunction(**testargs) File "C:\test_repos\pre_sales_test_python\test_prod\test_orders_and_payment_flow.py", line 77, in test_Orders_and_Payment_Flow_certification logging.info(f"course_data: {course_data}") Message: "course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '₹ 11,940.00', 'final_price': '14,089.20'}, (['Credit Card', 'Debit Card', 'Net Banking', 'UPI', 'EMI', '', 'CCAvenue'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'debitcard': 'All option clickable and Payment CTA appearing '}, {'net_banking': 'All option clickable and Payment CTA appearing '}, {'UPI': 'Payment CTA appearing'}, {'EMI': 'Payment CTA appearing'}, {'CCAvenue': 'Payment CTA appearing'}]))" Arguments: ()
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: IN INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:selenium_helper.py:61 Message: WARNING  setup:selenium_helper.py:62 the locator ('xpath', "//li[@id='shopse']//h2[contains(text(),'EMI')][not(contains(@style,'none'))]/ancestor::a") on url https://www.simplilearn.com/secure/checkout/details?authtoken=9e59c5291941d3c0c27590909f7f8e3ec69c0ca46f8f80e878f8ac0e7d570723 is not visible INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:316 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '₹ 11,940.00', 'final_price': '14,089.20'}, (['Credit Card', 'Debit Card', 'Net Banking', 'UPI', 'EMI', '', 'CCAvenue'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'debitcard': 'All option clickable and Payment CTA appearing '}, {'net_banking': 'All option clickable and Payment CTA appearing '}, {'UPI': 'Payment CTA appearing'}, {'EMI': 'Payment CTA appearing'}, {'CCAvenue': 'Payment CTA appearing'}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: 9e59c5291941d3c0c27590909f7f8e3ec69c0ca46f8f80e878f8ac0e7d570723 INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:8:"14089.20";s:9:"basePrice";s:16:"11940.0000000000";s:19:"display_total_price";s:9:"11,940.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+91-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '14089.20', 'basePrice': '11940.0000000000', 'display_total_price': '11,940.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[G] 96.87
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: US INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '$ 1,049.00', 'final_price': '1,049.00'}, (['Credit Card', 'Paypal', 'Klarna'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: e821f21d48a6ec9faaf2748178068a7112680d2148b707121808e156649794f7 INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1049.00";s:9:"basePrice";s:15:"1049.0000000000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+1-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1049.00', 'basePrice': '1049.0000000000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[L] 127.10
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: GB INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:ssvc_cart_page.py:55 Exception in City dropdown Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\pages_prod\ssvc_cart_page.py", line 52, in fill_learner_details_and_proceed self.city_dropdown.select_element_by_index(1) File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: city_dropdown INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '£ 1,049.00', 'final_price': '1,049.00'}, (['Credit Card', 'Paypal'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: 85f4ce9217b309b60f01093e3132a3dd7aaed8108bdc54705a507c56348dfd7c INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1049.00";s:9:"basePrice";s:9:"1049.0000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+1-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1049.00', 'basePrice': '1049.0000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[Q] 134.55
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: AU INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:ssvc_cart_page.py:55 Exception in City dropdown Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\pages_prod\ssvc_cart_page.py", line 52, in fill_learner_details_and_proceed self.city_dropdown.select_element_by_index(1) File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: city_dropdown INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': 'A$ 1,049.00', 'final_price': '1,049.00'}, (['Credit Card', 'Paypal'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: 1ad04333d87aca45d7c72ffb6f0d92b1dd4a5fe79035d7845704e4b565a5ed53 INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1049.00";s:9:"basePrice";s:15:"1049.0000000000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+61-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1049.00', 'basePrice': '1049.0000000000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[V] 124.44
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: DE INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:ssvc_cart_page.py:55 Exception in City dropdown Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\pages_prod\ssvc_cart_page.py", line 52, in fill_learner_details_and_proceed self.city_dropdown.select_element_by_index(1) File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: city_dropdown INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '€ 1,049.00', 'final_price': '1,049.00'}, (['Credit Card', 'Paypal', '2Checkout'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}, {'2checkout': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: 370c4cfcaf59e5c0dfdc35e01df65a184b1a50ac77f2ea36db12e87d88ef2eab INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1049.00";s:9:"basePrice";s:15:"1049.0000000000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+61-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1049.00', 'basePrice': '1049.0000000000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AA] 125.62
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: SG INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:ssvc_cart_page.py:55 Exception in City dropdown Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\pages_prod\ssvc_cart_page.py", line 52, in fill_learner_details_and_proceed self.city_dropdown.select_element_by_index(1) File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: city_dropdown INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '$ 1,049.00', 'final_price': '1,132.92'}, (['Credit Card', 'Paypal', '2Checkout'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}, {'2checkout': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: de682ca26d6900d6c94ddf598f0b90113bfe55a003e5ba77b6e84bab51b5affe INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1132.92";s:9:"basePrice";s:15:"1049.0000000000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+61-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1132.92', 'basePrice': '1049.0000000000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']
Passed test_orders_and_payment_flow.py::TestOrderAndPaymentFlowCertificationProgram::test_Orders_and_Payment_Flow_certification[AF] 126.52
-------------------------------Captured log call--------------------------------
INFO  setup:test_orders_and_payment_flow.py:55 Total URL Present is: 5 INFO  setup:test_orders_and_payment_flow.py:66 Url Opened is: https://www.simplilearn.com/agile-and-scrum/pmi-acp-certification-training INFO  setup:orders_page.py:30 Country Set to: AE INFO  setup:orders_page.py:159 clicked on Enroll Now button for Masters Program INFO  setup:orders_page.py:162 Payment Page Loaded ERROR  setup:ssvc_cart_page.py:55 Exception in City dropdown Traceback (most recent call last): File "C:\test_repos\pre_sales_test_python\pages_prod\ssvc_cart_page.py", line 52, in fill_learner_details_and_proceed self.city_dropdown.select_element_by_index(1) File "C:\test_repos\pre_sales_test_python\core\page_factory.py", line 60, in __getattr__ raise NoSuchElementException("An exception of type " + type(error).__name__ + " occurred. With Element -: " + loc) selenium.common.exceptions.NoSuchElementException: Message: An exception of type TimeoutException occurred. With Element -: city_dropdown INFO  setup:test_orders_and_payment_flow.py:162 <class 'tuple'> INFO  setup:ssvc_cart_page.py:336 Payment Deatils Entered INFO  setup:test_orders_and_payment_flow.py:74 <class 'tuple'> INFO  setup:test_orders_and_payment_flow.py:77 course_data: ({'course_name': 'PMI-ACP®', 'course_type': 'Online Self Learning', 'base_price': '$ 1,049.00', 'final_price': '1,049.00'}, (['Credit Card', 'Paypal', '2Checkout'], [{'creditcard': 'All option clickable and Payment CTA appearing '}, {'Paypal': 'Payment CTA appearing '}, {'2checkout': 'Payment CTA appearing '}])) INFO  setup:test_orders_and_payment_flow.py:81 Token No is: e4bc53a25805983e447d1dea8d92cd8adf484e3e3a0b93c98eccbfd19adb2a28 INFO  setup:test_orders_and_payment_flow.py:85 RAW SQL Data: [{'items': 'a:1:{i:0;a:23:{s:2:"id";s:1:"9";s:4:"name";s:41:"PMI-ACP<sup>®</sup> Online Self Learning";s:11:"description";s:4:" - 1";s:5:"price";s:7:"1049.00";s:9:"basePrice";s:15:"1049.0000000000";s:19:"display_total_price";s:8:"1,049.00";s:8:"quantity";i:1;s:11:"isEarlyBird";i:0;s:4:"type";s:6:"online";s:15:"trainingType_id";s:1:"2";s:10:"accessDays";s:3:"180";s:13:"productTypeId";s:1:"1";s:15:"productTypeName";s:6:"course";s:11:"actual_name";s:20:"PMI-ACP<sup>®</sup>";s:7:"priceId";s:0:"";s:11:"billingType";i:1;s:7:"img_url";s:81:"https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz";s:10:"course_url";s:47:"/agile-and-scrum/pmi-acp-certification-training";s:17:"training_type_txt";s:20:"Online Self Learning";s:9:"messageTT";s:0:"";s:16:"primary_label_id";s:1:"9";s:18:"primary_label_name";s:15:"Agile and Scrum";s:12:"cateforyInfo";a:1:{i:9;s:15:"Agile and Scrum";}}}', 'emailId': 'simplilearnautomation@gmail.com', 'contactNumber': '+61-123456789'}] INFO  setup:test_orders_and_payment_flow.py:87 SQL DATA in JSON format: {'id': '9', 'name': 'PMI-ACP Online Self Learning', 'description': ' - 1', 'price': '1049.00', 'basePrice': '1049.0000000000', 'display_total_price': '1,049.00', 'quantity': 'isEarlyBird', 'type': 'online', 'trainingType_id': '2', 'accessDays': '180', 'productTypeId': '1', 'productTypeName': 'course', 'actual_name': 'PMI-ACP', 'priceId': '', 'img_url': 'https://www.simplilearn.com/ice9/course_images/icons/AGILE-AND-SCRUM-PMI-ACP.svgz', 'course_url': '/agile-and-scrum/pmi-acp-certification-training', 'training_type_txt': 'Online Self Learning', 'messageTT': '', 'primary_label_id': '9', 'primary_label_name': 'Agile and Scrum'} INFO  setup:test_orders_and_payment_flow.py:284 Verifiaction Status Log Message: ['DB Verification Successfull']