package: qacode.core.webs.controls

Class: ControlBase

Package module qacode.core.webs.control_base

class qacode.core.webs.controls.control_base.ControlBase(bot, **kwargs)[source]

Bases: object

Requirements: #35, #70

attr_class = None
attr_id = None
auto_reload = None
bot = None
clear()[source]

Clear input element text value

click(retry=True)[source]

Click on element

element = None
find_child(selector, locator='css selector')[source]
Find child element using bot with default By.CSS_SELECTOR strategy
for internal element trought selenium WebElement
Arguments:
selector {str} – string search for locator type
Keyword Arguments:
locator {[selenium.webdriver.common.by.By]} – string type to
use on this selenium search request (default: {By.CSS_SELECTOR})
Returns:
ControlBase – instanced base element using qacode library object
find_children(selector, locator='css selector')[source]
Find children elements using bot with default By.CSS_SELECTOR
strategy for internal element trought selenium WebElement
Arguments:
selector {str} – string search for locator type
Keyword Arguments:
locator {[selenium.webdriver.common.by.By]} – string type to
use on this selenium search request (default: {By.CSS_SELECTOR})
Returns:
list(ControlBase) – instanced list of base element using
qacode library object
get_attr_value(attr_name)[source]

Search and attribute name over self.element and get value, if attr_value is obtained, then compare and raise if not

Arguments:
attr_name {str} – find an attribute on WebElement
with this name
Returns:
str – value of html attr_name
get_attrs(attr_names)[source]

Find a list of attributes on WebElement and returns a dict list of {name, value}

Arguments:
attr_names {list of str} – list of attr_name to search
for each one name and value on self.element
Returns:
dict – a dict list of {name, value}
get_css_value(prop_name)[source]

Allows to obtain CSS value based on CSS property name

Arguments:
prop_name {str} – CSS property name
Returns:
str – Value of CSS property searched
get_tag()[source]

Returns tag_name from Webelement

get_text(on_screen=True)[source]
Get element content text.
If the isDisplayed() method can sometimes trip over when the element is not really hidden but outside the viewport get_text() returns an empty string for such an element.
Keyword Arguments:
on_screen {bool} – allow to obtain text if element
it not displayed to this element before read text (default: {True})
Returns:
str – Return element content text (innerText property)
instance = None
is_displayed = None
is_enabled = None
is_selected = None
locator = None
name = None
reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

selector = None
set_css_value(prop_name, prop_value, css_important=True)[source]
Set new value for given CSS property name
on ControlBase selector
Arguments:
prop_name {str} – CSS property name prop_value {str} – CSS property value
Keyword Arguments:
css_important {bool} – Allow to include ‘!important’ to rule for
overrite others values applied (default: {True})
settings = None
tag = None
text = None
type_text(text, clear=False)[source]

Type text on input element

Arguments:
text {str} – string to be typed on web element
Keyword Arguments:
clear {bool} – clear text element at enable key (default: {False})

Wait until control pops and dissapears

wait_invisible(timeout=0)[source]

Wait for invisible element, returns control

wait_text(text, timeout=0)[source]

Wait if the given text is present in the specified control

wait_visible(timeout=0)[source]

Wait for visible element, returns control

class qacode.core.webs.controls.control_base.ControlBase(bot, **kwargs)[source]

Requirements: #35, #70

clear()[source]

Clear input element text value

click(retry=True)[source]

Click on element

find_child(selector, locator='css selector')[source]
Find child element using bot with default By.CSS_SELECTOR strategy
for internal element trought selenium WebElement
Arguments:
selector {str} – string search for locator type
Keyword Arguments:
locator {[selenium.webdriver.common.by.By]} – string type to
use on this selenium search request (default: {By.CSS_SELECTOR})
Returns:
ControlBase – instanced base element using qacode library object
find_children(selector, locator='css selector')[source]
Find children elements using bot with default By.CSS_SELECTOR
strategy for internal element trought selenium WebElement
Arguments:
selector {str} – string search for locator type
Keyword Arguments:
locator {[selenium.webdriver.common.by.By]} – string type to
use on this selenium search request (default: {By.CSS_SELECTOR})
Returns:
list(ControlBase) – instanced list of base element using
qacode library object
get_attr_value(attr_name)[source]

Search and attribute name over self.element and get value, if attr_value is obtained, then compare and raise if not

Arguments:
attr_name {str} – find an attribute on WebElement
with this name
Returns:
str – value of html attr_name
get_attrs(attr_names)[source]

Find a list of attributes on WebElement and returns a dict list of {name, value}

Arguments:
attr_names {list of str} – list of attr_name to search
for each one name and value on self.element
Returns:
dict – a dict list of {name, value}
get_css_value(prop_name)[source]

Allows to obtain CSS value based on CSS property name

Arguments:
prop_name {str} – CSS property name
Returns:
str – Value of CSS property searched
get_tag()[source]

Returns tag_name from Webelement

get_text(on_screen=True)[source]
Get element content text.
If the isDisplayed() method can sometimes trip over when the element is not really hidden but outside the viewport get_text() returns an empty string for such an element.
Keyword Arguments:
on_screen {bool} – allow to obtain text if element
it not displayed to this element before read text (default: {True})
Returns:
str – Return element content text (innerText property)
reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

set_css_value(prop_name, prop_value, css_important=True)[source]
Set new value for given CSS property name
on ControlBase selector
Arguments:
prop_name {str} – CSS property name prop_value {str} – CSS property value
Keyword Arguments:
css_important {bool} – Allow to include ‘!important’ to rule for
overrite others values applied (default: {True})
type_text(text, clear=False)[source]

Type text on input element

Arguments:
text {str} – string to be typed on web element
Keyword Arguments:
clear {bool} – clear text element at enable key (default: {False})
wait_blink(timeout=0)[source]

Wait until control pops and dissapears

wait_invisible(timeout=0)[source]

Wait for invisible element, returns control

wait_text(text, timeout=0)[source]

Wait if the given text is present in the specified control

wait_visible(timeout=0)[source]

Wait for visible element, returns control

Class: ControlForm

Package module qacode.core.webs.control_form

class qacode.core.webs.controls.control_form.ControlForm(bot, **kwargs)[source]

Bases: qacode.core.webs.controls.control_base.ControlBase

Requirements: #63

IS_DROPDOWN = None
IS_TABLE = None
reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

strict_tag = None
class qacode.core.webs.controls.control_form.ControlForm(bot, **kwargs)[source]

Requirements: #63

reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

Class: ControlDropdown

Package module qacode.core.webs.control_form

class qacode.core.webs.controls.control_dropdown.ControlDropdown(bot, **kwargs)[source]

Bases: qacode.core.webs.controls.control_form.ControlForm

TODO: doc class

deselect(text, by_value=False, by_index=False)[source]
The Select class only works with tags which have select tags.
Using the Index of Dropdown (int) Using the Value of Dropdown (str) Using the Text of Dropdown (str)
Arguments:
text {str|int} – Probably the easiest way of doing it. You
have to match the text which is displayed in the drop down.
Keyword Arguments:
by_value {bool} – We can use to select an option using the
value attribute. (default: {False})
by_index {bool} – We can use to select an option using the
index attribute. (default: {False})
Raises:
ControlException – if tag is not ‘select’ ControlException – if all flags are ‘True’
deselect_all()[source]
The Select class only works with tags which have select
tags with multiple=”multiple” attribute.
Raises:
ControlException – if tag is not ‘select’
dropdown = None
reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

select(text, by_value=False, by_index=False)[source]
The Select class only works with tags which have select tags.
Using the Index of Dropdown (int) Using the Value of Dropdown (str) Using the Text of Dropdown (str)
Arguments:
text {str|int} – Probably the easiest way of doing it. You
have to match the text which is displayed in the drop down.
Keyword Arguments:
by_value {bool} – We can use to select an option using the
value attribute. (default: {False})
by_index {bool} – We can use to select an option using the
index attribute. (default: {False})
Raises:
ControlException – if tag is not ‘select’ ControlException – if all flags are ‘True’
class qacode.core.webs.controls.control_dropdown.ControlDropdown(bot, **kwargs)[source]

TODO: doc class

deselect(text, by_value=False, by_index=False)[source]
The Select class only works with tags which have select tags.
Using the Index of Dropdown (int) Using the Value of Dropdown (str) Using the Text of Dropdown (str)
Arguments:
text {str|int} – Probably the easiest way of doing it. You
have to match the text which is displayed in the drop down.
Keyword Arguments:
by_value {bool} – We can use to select an option using the
value attribute. (default: {False})
by_index {bool} – We can use to select an option using the
index attribute. (default: {False})
Raises:
ControlException – if tag is not ‘select’ ControlException – if all flags are ‘True’
deselect_all()[source]
The Select class only works with tags which have select
tags with multiple=”multiple” attribute.
Raises:
ControlException – if tag is not ‘select’
reload(**kwargs)[source]

Reload ‘self.settings’ property:dict and call to instance logic with new configuration

select(text, by_value=False, by_index=False)[source]
The Select class only works with tags which have select tags.
Using the Index of Dropdown (int) Using the Value of Dropdown (str) Using the Text of Dropdown (str)
Arguments:
text {str|int} – Probably the easiest way of doing it. You
have to match the text which is displayed in the drop down.
Keyword Arguments:
by_value {bool} – We can use to select an option using the
value attribute. (default: {False})
by_index {bool} – We can use to select an option using the
index attribute. (default: {False})
Raises:
ControlException – if tag is not ‘select’ ControlException – if all flags are ‘True’