Module my_autopylot.chrome39

Classes

class ChromeBrowser

Methods

def check_if(self, text: str = '', element: str = 't')

Description

Check if a specific element is found.

Args

text : str, optional
To wait until the string appears on the screen.
Eg
Export Successful Completed. Defaults: ""
element : str, optional
Type of Element Whether its a Text(t) or Button(b).
Defaults
"t - Text".

Returns

[status] status (bool): Whether the function is successful or failed.

def close(self)

Description

Close the current active browser.

Args

None

Returns

[status]
status (bool): Whether the function is successful or failed.

def get_element_image(self, element_xpath: str = '', base64_image: bool = True, image_name: str = '')

Get the image of the element.

Args

element_xpath : str, optional
The xpath of the element. Defaults: ""

Returns

bool
Whether the function is successful or failed.
str
The image of the element.
def get_text(self, element_xpath: str = '')

Description

Get the text of the element.

Args

element_xpath : str, optional
The xpath of the element. Defaults: ""

Returns

[status, data] status (bool): Whether the function is successful or failed. data (str): The text of the element.

def get_value_relatively(self, element_type='Text', above='', below='', to_left_of='', to_right_of='')

Description

Text Element : Get the value of the element Link Element : Get the text of the element Button Element : Performs single left click on the element

Args

element_type : str, optional
The type of the element. Defaults: "Text".
above : str, optional
The xpath of the element above. Defaults: "".
below : str, optional
The xpath of the element below. Defaults: "".
to_left_of : str, optional
The xpath of the element to the left of. Defaults: "".
to_right_of : str, optional
The xpath of the element to the right of. Defaults: "".

Returns

[status, data] status (bool): Whether the function is successful or failed. data (str): The value of the element.

def hit_enter(self)

Description

Hits enter KEY in Browser

Args

None

Returns

[status] status (bool): Whether the function is successful or failed.

def key_press(self, key_1: str = '', key_2: str = '')

Description

Type text using Browser Helium Functions and press hot keys.

Args

key_1 : str
Keys you want to simulate or string you want to press
Eg
"tab" or "Murali". Defaults: ""
key_2 : str, optional
Key you want to simulate with combination to key_1.
Eg
"shift" or "escape". Defaults: ""

Returns

[status] status (bool): Whether the function is successful or failed.

def mouse(self, value: str = '', action_type: str = 'single', value_type: str = 'text')

Description: Performs a Mouse Click on the given value.

Args

value : str, optional
The value which has to be clicked.
Defaults
"".
action_type : str, optional
The type of click.
Defaults
"single".
value_type : str, optional
The type of value.
Defaults
"text".

Returns

[status] status (bool): Whether the function is successful or failed.

def mouse_v2(self, value: str = '', action_type: str = 'single', value_type: str = 't')

Description: Performs a Mouse Click on the given value.

Args

value : str, optional
The value which has to be clicked.
Defaults
"".
action_type : str, optional
The type of click.
Defaults
"single".
value_type : str, optional
The type of value.
Defaults
"text".

Returns

[status] status (bool): Whether the function is successful or failed.

def navigate(self, url: str = '')

Description

Navigate through the url after the session is started.

Args

url : str, optional
Url which you want to visit.
Defaults
"".

Returns

[status] status (bool): Whether the function is successful or failed.

def open_browser(self, dummy_browser: bool = True, profile: str = 'Default', incognito: bool = False)

Description

This function opens a browser.

Args

dummy_browser : bool, optional
True to open dummy browser.
Defaults
True.
profile : str, optional
Profile name to open.
Defaults
"Default".
incognito : bool, optional
True to open incognito browser.
Defaults
False.

Returns

[status, browser_driver] status (bool): Whether the function is successful or failed. browser_driver (object): The browser driver object.

def refresh_page(self)

Description

Refresh the current active browser page.

Args

None

Returns

[status] status (bool): Whether the function is successful or failed.

def scroll(self, direction: str = 'down', weight=3)

Description

Scrolls the browser window.

Args

direction : str, optional
The direction to scroll. Defaults: "down".u,d,l,r

weight : The weight of the scroll. Defaults: 3. 3 corresponds to 300 pixs

Returns

[status] status (bool): Whether the function is successful or failed.

def set_download_path(self, path: str = '')

Set the download path for the browser.

Args

path : str, optional
The path to set. Defaults: "".

Returns

bool
Whether the function is successful or failed.
def set_waiting_time(self, time: int = 10)

Description

Set the waiting time for the self.browser_driver. If element is not found in the given time, it will raise an exception.

Args

time : [int]
The time in seconds to wait for the element to be found. Defaults: 10

Returns

[status] status (bool): Whether the function is successful or failed.

def wait_until(self, text: str = '', element: str = 't', delay=10)

Description

Wait until a specific element is found.

Args

text : str, optional
To wait until the string appears on the screen.
Eg
Export Successful Completed. Defaults: ""
element : str, optional
Type of Element Whether its a Text(t) or Button(b).
Defaults
"t - Text".

Returns

[status] status (bool): Whether the function is successful or failed.

def write(self, text: str = '', user_visible_text_element: str = '')

Description

Write a string in browser, if user_visible_text_element is given it writes on the given element.

Args

text : str, optional
String which has be written.
Defaults
"".
user_visible_text_element : str, optional
The element which is visible(Like : Sign in).
Defaults
"".

Returns

[status] status (bool): Whether the function is successful or failed.