Changes

Jump to: navigation, search

B2G/QA/Automation/Style Guide/Howtos

1,322 bytes added, 19:46, 6 November 2015
content added
</source>
== Handling Browser Instances ==As mentioned above, there is a difference between Browser and Browser Tabs. Also, the browser instances elements (URL bar, dialogs, buttons, etc.) are on a separate frame (system frame) from the displayed web contents. <br>In order to properly detect and manipulate all of them, it is necessary to switch between separate frames.<source python> search = Search(self.marionette) search.launch() # Note that within the go_to_url() method, it switches to the system frame, # operates with the URL bar, and then returns the browser instance object browser = search.go_to_url(self.test_url) # here, it switches to the iframe of the browser, to check the web content browser.switch_to_content() Wait(self.marionette).until(lambda m: m.title == 'Mozilla') link =self.marionette.find_element(By.CSS_SELECTOR, '#community a') link.tap() Wait(self.marionette).until(lambda m: m.title == 'Mozilla Community')  # need to go back to the system frame in order to tap the back button. browser.switch_to_chrome() browser.tap_back_button()  # need to switch into the iframe to check the displayed content browser.switch_to_content() Wait(self.marionette).until(lambda m: m.title == 'Mozilla')</source>TBD - mwargers
== Returning the page object after completing an action ==
When invoking a certain UI action causes the phone to open a new page, it is recommended to return the appropriate page object. <br />
352
edits

Navigation menu