text
stringlengths
81
112k
Function path: Animation.setPlaybackRate Domain: Animation Method name: setPlaybackRate Parameters: Required arguments: 'playbackRate' (type: number) -> Playback rate for animations on page No return value. Description: Sets the playback rate of the document timeline. def Animation_setPla...
Function path: Animation.getCurrentTime Domain: Animation Method name: getCurrentTime Parameters: Required arguments: 'id' (type: string) -> Id of animation. Returns: 'currentTime' (type: number) -> Current time of the page. Description: Returns the current time of the an animation. d...
Function path: Animation.setPaused Domain: Animation Method name: setPaused Parameters: Required arguments: 'animations' (type: array) -> Animations to set the pause state of. 'paused' (type: boolean) -> Paused state to set to. No return value. Description: Sets the paused state of a ...
Function path: Animation.setTiming Domain: Animation Method name: setTiming Parameters: Required arguments: 'animationId' (type: string) -> Animation id. 'duration' (type: number) -> Duration of the animation. 'delay' (type: number) -> Delay of the animation. No return value. Des...
Function path: Animation.seekAnimations Domain: Animation Method name: seekAnimations Parameters: Required arguments: 'animations' (type: array) -> List of animation ids to seek. 'currentTime' (type: number) -> Set the current time of each animation. No return value. Description: Seek...
Function path: Animation.releaseAnimations Domain: Animation Method name: releaseAnimations Parameters: Required arguments: 'animations' (type: array) -> List of animation ids to seek. No return value. Description: Releases a set of animations to no longer be manipulated. def Animation_re...
Function path: Animation.resolveAnimation Domain: Animation Method name: resolveAnimation Parameters: Required arguments: 'animationId' (type: string) -> Animation id. Returns: 'remoteObject' (type: Runtime.RemoteObject) -> Corresponding remote object. Description: Gets the remote obje...
Function path: Storage.clearDataForOrigin Domain: Storage Method name: clearDataForOrigin Parameters: Required arguments: 'origin' (type: string) -> Security origin. 'storageTypes' (type: string) -> Comma separated origin names. No return value. Description: Clears storage for origin....
Function path: Storage.getUsageAndQuota Domain: Storage Method name: getUsageAndQuota Parameters: Required arguments: 'origin' (type: string) -> Security origin. Returns: 'usage' (type: number) -> Storage usage (bytes). 'quota' (type: number) -> Storage quota (bytes). 'usageBreakdown...
Function path: Storage.trackCacheStorageForOrigin Domain: Storage Method name: trackCacheStorageForOrigin Parameters: Required arguments: 'origin' (type: string) -> Security origin. No return value. Description: Registers origin to be notified when an update occurs to its cache storage lis...
Function path: Storage.untrackCacheStorageForOrigin Domain: Storage Method name: untrackCacheStorageForOrigin Parameters: Required arguments: 'origin' (type: string) -> Security origin. No return value. Description: Unregisters origin from receiving notifications for cache storage. def St...
Function path: Log.startViolationsReport Domain: Log Method name: startViolationsReport Parameters: Required arguments: 'config' (type: array) -> Configuration for violations. No return value. Description: start violation reporting. def Log_startViolationsReport(self, config): """ Fun...
Function path: Tethering.bind Domain: Tethering Method name: bind Parameters: Required arguments: 'port' (type: integer) -> Port number to bind. No return value. Description: Request browser port binding. def Tethering_bind(self, port): """ Function path: Tethering.bind Domain: Tet...
Function path: Tethering.unbind Domain: Tethering Method name: unbind Parameters: Required arguments: 'port' (type: integer) -> Port number to unbind. No return value. Description: Request browser port unbinding. def Tethering_unbind(self, port): """ Function path: Tethering.unbind ...
Function path: Browser.setWindowBounds Domain: Browser Method name: setWindowBounds Parameters: Required arguments: 'windowId' (type: WindowID) -> Browser window id. 'bounds' (type: Bounds) -> New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left...
Function path: Runtime.evaluate Domain: Runtime Method name: evaluate Parameters: Required arguments: 'expression' (type: string) -> Expression to evaluate. Optional arguments: 'objectGroup' (type: string) -> Symbolic group name that can be used to release multiple objects. 'includeCo...
Function path: Runtime.callFunctionOn Domain: Runtime Method name: callFunctionOn Parameters: Required arguments: 'functionDeclaration' (type: string) -> Declaration of the function to call. Optional arguments: 'objectId' (type: RemoteObjectId) -> Identifier of the object to call function ...
Function path: Runtime.releaseObjectGroup Domain: Runtime Method name: releaseObjectGroup Parameters: Required arguments: 'objectGroup' (type: string) -> Symbolic object group name. No return value. Description: Releases all remote objects that belong to a given group. def Runtime_release...
Function path: Runtime.setCustomObjectFormatterEnabled Domain: Runtime Method name: setCustomObjectFormatterEnabled WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'enabled' (type: boolean) -> No description No return value. def Runtime_setCustomObjectForm...
Function path: Runtime.compileScript Domain: Runtime Method name: compileScript Parameters: Required arguments: 'expression' (type: string) -> Expression to compile. 'sourceURL' (type: string) -> Source url to be set for the script. 'persistScript' (type: boolean) -> Specifies whether the...
Function path: Runtime.runScript Domain: Runtime Method name: runScript Parameters: Required arguments: 'scriptId' (type: ScriptId) -> Id of the script to run. Optional arguments: 'executionContextId' (type: ExecutionContextId) -> Specifies in which execution context to perform script run....
Function path: Debugger.setBreakpointsActive Domain: Debugger Method name: setBreakpointsActive Parameters: Required arguments: 'active' (type: boolean) -> New value for breakpoints active state. No return value. Description: Activates / deactivates all breakpoints on the page. def Debugg...
Function path: Debugger.setSkipAllPauses Domain: Debugger Method name: setSkipAllPauses Parameters: Required arguments: 'skip' (type: boolean) -> New value for skip pauses state. No return value. Description: Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc)...
Function path: Debugger.setScriptSource Domain: Debugger Method name: setScriptSource Parameters: Required arguments: 'scriptId' (type: Runtime.ScriptId) -> Id of the script to edit. 'scriptSource' (type: string) -> New content of the script. Optional arguments: 'dryRun' (type: boolea...
Function path: Debugger.setPauseOnExceptions Domain: Debugger Method name: setPauseOnExceptions Parameters: Required arguments: 'state' (type: string) -> Pause on exceptions mode. No return value. Description: Defines pause on exceptions state. Can be set to stop on all exceptions, uncaugh...
Function path: Debugger.setVariableValue Domain: Debugger Method name: setVariableValue Parameters: Required arguments: 'scopeNumber' (type: integer) -> 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulat...
Function path: Debugger.setAsyncCallStackDepth Domain: Debugger Method name: setAsyncCallStackDepth Parameters: Required arguments: 'maxDepth' (type: integer) -> Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default). No retu...
Function path: Debugger.setBlackboxPatterns Domain: Debugger Method name: setBlackboxPatterns WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'patterns' (type: array) -> Array of regexps that will be used to check script url for blackbox state. No return va...
Function path: Debugger.setBlackboxedRanges Domain: Debugger Method name: setBlackboxedRanges WARNING: This function is marked 'Experimental'! Parameters: Required arguments: 'scriptId' (type: Runtime.ScriptId) -> Id of the script. 'positions' (type: array) -> No description No return...
Function path: Profiler.setSamplingInterval Domain: Profiler Method name: setSamplingInterval Parameters: Required arguments: 'interval' (type: integer) -> New sampling interval in microseconds. No return value. Description: Changes CPU profiler sampling interval. Must be called before CPU...
Given a set of headers, update both the user-agent and additional headers for the remote browser. header_args must be a dict. Keys are the names of the corresponding HTTP header. return value is a 2-tuple of the results of the user-agent update, as well as the extra headers update. If no 'User-Agent' key ...
Retreive the cookies from the remote browser. Return value is a list of http.cookiejar.Cookie() instances. These can be directly used with the various http.cookiejar.XXXCookieJar cookie management classes. def get_cookies(self): ''' Retreive the cookies from the remote browser. Return value is a list of ...
Add a cookie to the remote chromium instance. Passed value `cookie` must be an instance of `http.cookiejar.Cookie()`. def set_cookie(self, cookie): ''' Add a cookie to the remote chromium instance. Passed value `cookie` must be an instance of `http.cookiejar.Cookie()`. ''' # Function path: Network.setCo...
Probe the remote session for the current window URL. This is primarily used to do things like unwrap redirects, or circumvent outbound url wrappers. def get_current_url(self): ''' Probe the remote session for the current window URL. This is primarily used to do things like unwrap redirects, or circumvent...
Get the title and current url from the remote session. Return is a 2-tuple: (page_title, page_url). def get_page_url_title(self): ''' Get the title and current url from the remote session. Return is a 2-tuple: (page_title, page_url). ''' cr_tab_id = self.transport._get_cr_tab_meta_for_key(self.tab_id)[...
Execute a javascript string in the context of the browser tab. def execute_javascript(self, *args, **kwargs): ''' Execute a javascript string in the context of the browser tab. ''' ret = self.__exec_js(*args, **kwargs) return ret
DOM_performSearch(self, query, includeUserAgentShadowDOM) Python Function: DOM_performSearch Domain: DOM Method name: performSearch WARNING: This function is marked 'Experimental'! Parameters: 'query' (type: string) -> Plain text or query selector or XPath s...
Return a unpacked, decoded resposne body from Network_getResponseBody() def get_unpacked_response_body(self, requestId, mimetype="application/unknown"): ''' Return a unpacked, decoded resposne body from Network_getResponseBody() ''' content = self.Network_getResponseBody(requestId) assert 'result' in conten...
If the chrome tab has internally redirected (generally because jerberscript), this will walk the page navigation responses and attempt to fetch the response body for the tab's latest location. def handle_page_location_changed(self, timeout=None): ''' If the chrome tab has internally redirected (generally becau...
Do a blocking navigate to url `url`, and then extract the response body and return that. This effectively returns the *unrendered* page content that's sent over the wire. As such, if the page does any modification of the contained markup during rendering (via javascript), this function will not reflect the cha...
Get the HTML markup for the current page. This is done by looking up the root DOM node, and then requesting the outer HTML for that node ID. This calls return will reflect any modifications made by javascript to the page. For unmodified content, use `blocking_navigate_and_get_source()` dom_idle_requirement...
Take a screenshot of the virtual viewport content. Return value is a png image as a bytestring. def take_screeshot(self): ''' Take a screenshot of the virtual viewport content. Return value is a png image as a bytestring. ''' resp = self.Page_captureScreenshot() assert 'result' in resp assert 'data' ...
Do a blocking navigate to url `url`. This function triggers a navigation, and then waits for the browser to claim the page has finished loading. Roughly, this corresponds to the javascript `DOMContentLoaded` event, meaning the dom for the page is ready. Internals: A navigation command results in a sequ...
Get a chromium tab from the pool, optionally one that has an association with a specific netloc/URL. If no url or netloc is specified, the per-thread identifier will be used. If `extra_id` is specified, it's stringified value will be mixed into the pool key If `use_tid` is true, the per-thread identifier will be...
Return a function to be run in a child process which will trigger SIGNAME to be sent when the parent process dies def on_parent_exit(signame): """ Return a function to be run in a child process which will trigger SIGNAME to be sent when the parent process dies """ signum = getattr(signal, signa...
Context manager for conveniently handling the lifetime of the underlying chromium instance. In general, this should be the preferred way to use an instance of `ChromeRemoteDebugInterface`. All parameters are forwarded through to the underlying ChromeRemoteDebugInterface() constructor. def ChromeContext(*args, **kw...
Forward a command to the remote chrome instance via the transport connection, and check the return for an error. If the command resulted in an error, a `ChromeController.ChromeError` is raised, with the error string containing the response from the remote chrome instance describing the problem and it's cause. ...
"Drain" the transport connection. This command simply returns all waiting messages sent from the remote chrome instance. This can be useful when waiting for a specific asynchronous message from chrome, but higher level calls are better suited for managing wait-for-message type needs. def drain_transport(self)...
This function is a HACK! Basically, if we fork() while a logging lock is held, the lock is /copied/ while in the acquired state. However, since we've forked, the thread that acquired the lock no longer exists, so it can never unlock the lock, and we end up blocking forever. Therefore, we manually enter the logg...
Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an 'encoding' attribute, it is us...
Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emit. def emit(self, record): """ Emit a record. If the stream was not opened because 'delay' was specified in the constructor, open it before calling the superclass's emi...
This is the version from Django 1.7. def run_suite(self, suite, **kwargs): """This is the version from Django 1.7.""" return self.test_runner( verbosity=self.verbosity, failfast=self.failfast, no_colour=self.no_colour, ).run(suite)
Generates a private key of key_length bits and attaches it to the object as the __private_key variable. :return: void :rtype: void def generate_private_key(self): """ Generates a private key of key_length bits and attaches it to the object as the __private_key variable. :retur...
Generates public key. :return: void :rtype: void def generate_public_key(self): """ Generates public key. :return: void :rtype: void """ self.public_key = pow(self.generator, self.__private_key, ...
Generates shared secret from the other party's public key. :param other_public_key: Other party's public key :type other_public_key: int :param echo_return_key: Echo return shared key :type bool :return: void :rtype: void def generate_shared_secret(self, other_public_ke...
Decorator for functions that require the private key to be defined. def requires_private_key(func): """ Decorator for functions that require the private key to be defined. """ def func_wrapper(self, *args, **kwargs): if hasattr(self, "_DiffieHellman__private_key"): func(self, *args...
Decorator for functions that require the public key to be defined. By definition, this includes the private key, as such, it's enough to use this to effect definition of both public and private key. def requires_public_key(func): """ Decorator for functions that require the public key to be defined. By definit...
Print if and only if the debug flag is set true in the config.yaml file. Args: args : var args of print arguments. def print_debug(*args, **kwargs): """ Print if and only if the debug flag is set true in the config.yaml file. Args: args : var args of print arguments. """ if W...
Print the current elapsed time. Kwargs: message (str) : Message to prefix the time stamp. print_frame_info (bool) : Add frame info to the print message. def print_time(self, message="Time is now: ", print_frame_info=True): """ Print the current elapsed time. Kw...
Check if resource at URL is fetchable. (by trying to fetch it and checking for 200 status. Args: url (str): Url to check. Returns: Returns a tuple of {True/False, response code} def check_url(url): ''' Check if resource at URL is fetchable. (by trying to fetch ...
Get the current base URL. Args: webdriver: Selenium WebDriver instance. Returns: str - base URL. Usage:: driver.get("http://www.google.com/?q=hello+world") WebUtils.get_base_url(driver) #returns 'http://www.google.com' def get_bas...
Get the current date/time on the web browser as a Python datetime object. This date matches 'new Date();' when ran in JavaScript console. Args: webdriver: Selenium WebDriver instance Returns: datetime - Python datetime object. Usage:: ...
Check if a web driver if mobile. Args: webdriver (WebDriver): Selenium webdriver. def is_webdriver_mobile(webdriver): """ Check if a web driver if mobile. Args: webdriver (WebDriver): Selenium webdriver. """ browser = webdriver.capabilities['br...
Check if a web driver if mobile. Args: webdriver (WebDriver): Selenium webdriver. def is_webdriver_ios(webdriver): """ Check if a web driver if mobile. Args: webdriver (WebDriver): Selenium webdriver. """ browser = webdriver.capabilities['brows...
Converts a row into a dictionary of key/values. (Note: assumes all rows/columns have uniform cells. Does not account for any row or column spans) Args: header_row_web_element (WebElement): WebElement reference to the column headers. row_webelement (WebElement):...
Utility method for switching between windows. It will search through currently open windows, then switch to the window matching the provided PageObject class. Args: page_class (PageObject): Page class to search for/instantiate. webdriver (WebDriver): Selenium webdriver. ...
Create an instance of BrowserStandBy() and immediately return a running instance. This is best used in a 'with' block. Example:: with BrowserStandBy.start_standby(): # Now browser is in standby, you can do a bunch of stuff with in this block. # ... ...
Start standing by. A periodic command like 'current_url' will be sent to the webdriver instance to prevent it from timing out. def start(self): """ Start standing by. A periodic command like 'current_url' will be sent to the webdriver instance to prevent it from timing out. ...
Gets a temp path. Kwargs: file_name (str) : if file name is specified, it gets appended to the temp dir. Usage:: temp_file_path = temp_path("myfile") copyfile("myfile", temp_file_path) # copies 'myfile' to '/tmp/myfile' def temp_path(file_name=None): """ Gets a temp path. ...
Creates a temp file using a given name. Temp files are placed in the Project/temp/ directory. Any temp files being created with an existing temp file, will be overridden. This is useful for testing uploads, where you would want to create a temporary file with a desired name, upload it, then delete the...
Downloads a URL contents to a tempfile. This is useful for testing downloads. It will download the contents of a URL to a tempfile, which you then can open and use to validate the downloaded contents. Args: url (str) : URL of the contents to download. Kwargs: file_name (str): Name of...
Class method short cut to call PageFactory on itself. Use it to instantiate this PageObject using a webdriver. Args: webdriver (Webdriver): Instance of Selenium Webdriver. Returns: PageObject Raises: InvalidPageError def create_page(cls, webdrive...
Instantiate a page object from a given Interface or Abstract class. Args: page_object_class_or_interface (Class): PageObject class, AbstractBaseClass, or Interface to attempt to consturct. Kwargs: webdriver (WebDriver): Selenium Webdriver to use to instantiate the ...
Attempts to instantiate a page object. Args: page_obj_class (PageObject) - PageObject to instantiate. webdriver (WebDriver) - Selenium webdriver to associate with the PageObject Returns: PageObject - If page object instantiation succeeded. True -...
Credit goes to: http://code.activestate.com/recipes/576949-find-all-subclasses-of-a-given-class/ itersubclasses(cls) Generator over all subclasses of a given class, in depth first order. >>> list(itersubclasses(int)) == [bool] True >>> class A(object): pass >>> class B...
Returns true if all CSS selectors passed in is found. This can be used to quickly validate a page. Args: webdriver (Webdriver) : Selenium Webdriver instance selectors (str) : N number of CSS selectors strings to match against the page. Returns: True, False...
Waits until the page is loaded. Args: page_obj_class (Class) : PageObject class Kwargs: webdriver (Webdriver) : Selenium Webdriver. Default uses WTF_WEBDRIVER_MANAGER's instance. timeout (number) : Number of seconds to wait to allow the page to load. sl...
Waits until document.readyState == Complete (e.g. ready to execute javascript commands) Args: page_object (PageObject) : PageObject class Kwargs: timeout (number) : timeout period def wait_until_page_ready(page_object, timeout=WTF_TIMEOUT_MANAGER.NORMAL): """Waits unti...
Get the full system path of a given asset if it exists. Otherwise it throws an error. Args: filename (str) - File name of a file in /assets folder to fetch the path for. Returns: str - path to the target file. Raises: AssetNotFoundError - if asset...
Creates an instance of Selenium webdriver based on config settings. This should only be called by a shutdown hook. Do not call directly within a test. Kwargs: testname: Optional test name to pass, this gets appended to the test name sent ...
Reads the config value for browser type. def __create_driver_from_browser_config(self): ''' Reads the config value for browser type. ''' try: browser_type = self._config_reader.get( WebDriverFactory.BROWSER_TYPE_CONFIG) except KeyError: _w...
Creates an instance of Safari webdriver. def __create_safari_driver(self): ''' Creates an instance of Safari webdriver. ''' # Check for selenium jar env file needed for safari driver. if not os.getenv(self.__SELENIUM_SERVER_JAR_ENV): # If not set, check if we have a ...
Creates an instance of PhantomJS driver. def __create_phantom_js_driver(self): ''' Creates an instance of PhantomJS driver. ''' try: return webdriver.PhantomJS(executable_path=self._config_reader.get(self.PHANTOMEJS_EXEC_PATH), service_...
Reads the config value for browser type. def __create_remote_webdriver_from_config(self, testname=None): ''' Reads the config value for browser type. ''' desired_capabilities = self._generate_desired_capabilities(testname) remote_url = self._config_reader.get( ...
Clean up webdrivers created during execution. def clean_up_webdrivers(self): ''' Clean up webdrivers created during execution. ''' # Quit webdrivers. _wtflog.info("WebdriverManager: Cleaning up webdrivers") try: if self.__use_shutdown_hook: fo...
Close current running instance of Webdriver. Usage:: driver = WTF_WEBDRIVER_MANAGER.new_driver() driver.get("http://the-internet.herokuapp.com") WTF_WEBDRIVER_MANAGER.close_driver() def close_driver(self): """ Close current running instance of Webdriver. ...
Get an already running instance of Webdriver. If there is none, it will create one. Returns: Webdriver - Selenium Webdriver instance. Usage:: driver = WTF_WEBDRIVER_MANAGER.new_driver() driver.get("http://the-internet.herokuapp.com") same_driver = WTF_W...
Used at a start of a test to get a new instance of WebDriver. If the 'resuebrowser' setting is true, it will use a recycled WebDriver instance with delete_all_cookies() called. Kwargs: testname (str) - Optional test name to pass to Selenium Grid. Helpful for ...
Register webdriver to a channel. def __register_driver(self, channel, webdriver): "Register webdriver to a channel." # Add to list of webdrivers to cleanup. if not self.__registered_drivers.has_key(channel): self.__registered_drivers[channel] = [] # set to new empty array ...
Unregister webdriver def __unregister_driver(self, channel): "Unregister webdriver" driver = self.__get_driver_for_channel(channel) if self.__registered_drivers.has_key(channel) \ and driver in self.__registered_drivers[channel]: self.__registered_drivers[channel]....
Get the channel to register webdriver to. def __get_channel(self): "Get the channel to register webdriver to." if self.__config.get(WebDriverManager.ENABLE_THREADING_SUPPORT, False): channel = current_thread().ident else: channel = 0 return channel
Captures a screenshot. Args: webdriver (WebDriver) - Selenium webdriver. file_name (str) - File name to save screenshot as. def take_screenshot(webdriver, file_name): """ Captures a screenshot. Args: webdriver (WebDriver) - Selenium webdriver. ...
Captures a screenshot as a reference screenshot. Args: webdriver (WebDriver) - Selenium webdriver. file_name (str) - File name to save screenshot as. def take_reference_screenshot(webdriver, file_name): """ Captures a screenshot as a reference screenshot. Args:...
Capture a screenshot def __capture_screenshot(webdriver, folder_location, file_name): "Capture a screenshot" # Check folder location exists. if not os.path.exists(folder_location): os.makedirs(folder_location) file_location = os.path.join(folder_location, file_name) ...
Return path of the project directory. Use this method for getting paths relative to the project. However, for data, it's recommended you use WTF_DATA_MANAGER and for assets it's recommended to use WTF_ASSET_MANAGER, which are already singleton instances that manger the /data, and /assets fold...
A retry wrapper that'll keep performing the action until it succeeds. (main differnce between do_until and wait_until is do_until will keep trying until a value is returned, while wait until will wait until the function evaluates True.) Args: lambda_expr (lambda) : Expression to evaluate. ...
Waits wrapper that'll wait for the condition to become true, but will not error if the condition isn't met. Args: condition (lambda) - Lambda expression to wait for to evaluate to True. Kwargs: timeout (number) : Maximum number of seconds to wait. sleep (number) : Sleep time to wa...
Waits wrapper that'll wait for the condition to become true. (main differnce between do_until and wait_until is do_until will keep trying until a value is returned, while wait until will wait until the function evaluates True.) Args: condition (lambda) - Lambda expression to wait for to evalu...
Searches for Email by Subject. Returns True or False. Args: subject (str): Subject to search for. Kwargs: match_recipient (str) : Recipient to match exactly. (don't care if not specified) Returns: True - email found, False - email not found def check_ema...
Searches for Email by Subject. Returns email's imap message IDs as a list if matching subjects is found. Args: subject (str) - Subject to search for. Kwargs: limit (int) - Limit search to X number of matches, default 50 match_recipient (str) - Recipient to...