improve selenium stubs (#1732)

This commit is contained in:
Jelle Zijlstra
2018-03-28 19:39:44 -07:00
committed by Łukasz Langa
parent 0c15e5bdcc
commit 371b805c23
2 changed files with 17 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List, Optional, Text
from .mobile import Mobile as Mobile
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.remote.errorhandler import ErrorHandler
@@ -14,10 +14,10 @@ class WebDriver:
error_handler = ... # type: ErrorHandler
file_detector = ... # type: FileDetector
def __init__(self,
command_executor: basestring='',
desired_capabilities: Capabilities=None,
browser_profile=None,
proxy=None,
command_executor: basestring = ...,
desired_capabilities: Capabilities = ...,
browser_profile: Optional[Any] = ..., # should be selenium.webdriver.firefox.firefox_profile.FirefoxProfile, but we don't have a stub for that
proxy: Optional[Any] = ..., # should be selenium.webdriver.common.proxy.Proxy, but there's no stub for that
keep_alive: bool = ...
) -> None: ...
@property
@@ -83,15 +83,15 @@ class WebDriver:
def find_element(self, by=..., value=None): ...
def find_elements(self, by=..., value=None): ...
@property
def desired_capabilities(self): ...
def get_screenshot_as_file(self, filename): ...
save_screenshot = ... # type: Any
def get_screenshot_as_png(self): ...
def get_screenshot_as_base64(self): ...
def set_window_size(self, width, height, windowHandle=''): ...
def get_window_size(self, windowHandle=''): ...
def set_window_position(self, x, y, windowHandle=''): ...
def get_window_position(self, windowHandle=''): ...
def desired_capabilities(self) -> Capabilities: ...
def get_screenshot_as_file(self, filename: Text) -> bool: ...
def save_screenshot(self, filename: Text) -> bool: ...
def get_screenshot_as_png(self) -> bytes: ...
def get_screenshot_as_base64(self) -> str: ...
def set_window_size(self, width: int, height: int, windowHandle: str = ...) -> None: ...
def get_window_size(self, windowHandle: str = ...) -> Dict[str, int]: ...
def set_window_position(self, x: int, y: int, windowHandle: str = ...) -> None: ...
def get_window_position(self, windowHandle: str = ...) -> Dict[str, int]: ...
@property
def file_detector(self): ...
@file_detector.setter

View File

@@ -1,5 +1,5 @@
from selenium.webdriver.remote.webdriver import WebDriver
from typing import Any, Optional, Dict, List
from typing import Optional, Dict, List, Text
SizeDict = Dict[str, int] # containing "height", "width"
PointDict = Dict[str, int] # containing "x", "y"
@@ -56,6 +56,6 @@ class WebElement:
def id(self) -> Optional[basestring]: ...
def __eq__(self, element: object) -> bool: ...
def __ne__(self, element: object) -> bool: ...
def find_element(self, by: basestring=..., value: basestring=None) -> WebElement: ...
def find_elements(self, by: basestring=..., value: basestring=None) -> List[WebElement]: ...
def find_element(self, by: Text = ..., value: Optional[Text] = ...) -> WebElement: ...
def find_elements(self, by: Text = ..., value: Optional[Text] = ...) -> List[WebElement]: ...
def __hash__(self) -> int: ...