Having issues with implementing Page Object Model in TestComplete using Python language
Using TestComplete with Python to automate Desktop project and trying to implement Page Object Model. Have 2 files:
#first file which contains test
Test001:
import ExcelObjects
def Test001():
#create object of Excel page class
eo = ExcelObjects()
#Runs the "EXCEL" tested application.
TestedApps.EXCEL.Run(1, True)
#Maximize window
Sys.Process("EXCEL").Form("Excel").Maximize()
#Selects the 'Blank workbook' item of the 'list' select control.
eo.blank_workbook.Click()
#second file with Page Object which will contain all the locators, methods etc. related to Excel page
ExcelObjects
class ExcelObjects:
blank_workbook = Aliases.EXCEL.wndXLMAIN.FullpageUIHost.ListItem("Blank workbook")
And when I run my test it gives me an error: "the object "list" does not exist"
so basically it tries to find this object "blank_workbook = Aliases.EXCEL.wndXLMAIN.FullpageUIHost.ListItem("Blank workbook")" even before it runs TestedApp. any thoughts why it calls that object on the beginning but not at the time where it placed (last step of the test)?
You CAN do a POM, but the code is going to probably be more complicated than you want. NameMapping is what is basically the replacement for POM in Silenium. All your main actions (click, keys, etc) are on the Alias objects themselves so you don't need, really, to create classes for each of the different objects. You just need to use NameMapping or one of those other methods that I suggested for building your objects.