def __init__(self, owner, locatordict={}): super(MembersProfileBiography,self).__init__(owner,locatordict) # load hub's classes MembersProfileBiography_Locators = self.load_class('MembersProfileBiography_Locators') # update this object's locator self.locators.update(MembersProfileBiography_Locators.locators) # update the locators with those from the owner self.update_locators_from_owner() # setup page object's components self.biography = TextArea(self,{'base':'biography'}) self.access = Select(self,{'base':'access'}) # update the component's locators with this objects overrides self._updateLocators()
class MembersProfileBiography(MembersProfileElement): def __init__(self, owner, locatordict={}): super(MembersProfileBiography,self).__init__(owner,locatordict) # load hub's classes MembersProfileBiography_Locators = self.load_class('MembersProfileBiography_Locators') # update this object's locator self.locators.update(MembersProfileBiography_Locators.locators) # update the locators with those from the owner self.update_locators_from_owner() # setup page object's components self.biography = TextArea(self,{'base':'biography'}) self.access = Select(self,{'base':'access'}) # update the component's locators with this objects overrides self._updateLocators() def value(self): """return a dictionary with the biography and access value settings""" return {'biography' : self.biography.value(), 'access' : self.access.value()} def update(self,biography=None,access=None): """update the biography and access settings""" if biography != None: self.biography.value = biography if access != None: self.access.value = access self.save.click()
logger = logging.getLogger(__name__) # open a web browser and load our example web page browser = Firefox() browser.get('file://'+ os.path.join(installdir,'iframe_example.html')) # create a page object to hold the widgets po = BasePageObject(browser,None) po.locators = { 'frame1' : 'css=#frame1' , 'frame2' : 'css=#frame2' , 't0' : 'css=#t0' , 't1' : 'css=#t1' , 't2' : 'css=#t2' , } t0 = TextArea(po,{'base':'t0'}) # t1 is a widget that represents the text area # element inside of the first iframe t1 = IframeWrap( TextArea(po,{'base':'t1'}), ['frame1'] ) # t2 is a widget that represents the text area # element inside of the second iframe t2 = IframeWrap( TextArea(po,{'base':'t2'}), ['frame2', 'frame1'] ) # print out the current text in the widgets print "t0.value = %s" % (t0.value) print "t1.value = %s" % (t1.value)