Actions.SeleniumActions package¶
Submodules¶
Actions.SeleniumActions.browser_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.SeleniumActions.browser_actions.
browser_actions
(*args, **kwargs)[source]¶ Bases:
object
This is a class that deals with all ‘browser’ related functionality like opening and closing a browser, maximizing a browser window, navigating to a URL, resizing a browser window.
-
browser_close
(system_name, type='firefox', browser_name='all')[source]¶ This will close the browser window.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
browser_launch
(system_name, browser_name='all', type='firefox', url=None, ip=None, remote=None, element_config_file=None, element_tag=None, headless_mode=None)[source]¶ The Keyword would launch a browser and Navigate to the url, if provided by the user.
This keyword does not validate the url provided by the user. Please use navigate_to_url_with_verification instead of providing a url with this keyword if you need to verify the navigation result. ————————————————————————————–
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- ip = Specify this tag as a direct child of the <system> tag
This tag would contain information about the IP of the remote machine on which you want your testcase to run
Eg: <ip>167.125.0.1</ip>
- remote = Specify this tag as a direct child of the <system> tag
This tag when set to set, would use the IP above and start up a browser on that machine. If this tag is set to ‘no’, a browser would launch on your machine
Eg: <remote>yes</remote>
- type = This <type> tag is a child of the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json file which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
- headless_mode = Run selenium test in headless mode
Used in system with no GUI component
The next 5 arguments are added for Selenium 3 with Firefox Please use them inside the browser tag in system data file binary = The absolute path of the browser executable
Eg: <binary>../../firefox/firefox</binary>
- gecko_path = The absolute path of the geckodriver
geckodriver is mandatory if using Firefox version 47 or above This also required Selenium 3.5 or above For more information please visit: https://github.com/mozilla/geckodriver#selenium Eg: <gecko_path>../../../geckodriver</gecko_path>
- gecko_log = The absolute path for the geckodriver log to be saved
This file only get generated if firefox is launched with geckodriver and failuer/error occur Default is the testcase log directory
- proxy_ip = This <proxy_ip> tag refers to the ip of the proxy
server. When a proxy is required this tag has to set Eg: <proxy_ip>xx.xxx.xx.xx</proxy_ip>
- proxy_port = This <proxy_port> tag refers to the port of the
proxy server. When a proxy is required for remote connection this tag has to set.
Eg: <proxy_port>yyyy</proxy_port>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- ip(str) = IP of the remote machine
- remote(str) = ‘yes’ or ‘no’ to indicate whether you want to
- connect to the given aboveIP
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
- headless_mode(str) = Enable headless_mode
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
browser_launch_and_maximize
(system_name, browser_name='all', type='firefox', url=None, ip=None, remote=None, element_config_file=None, element_tag=None)[source]¶ This will launch a browser and maximize the browser window if it is set.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_the_system”/>
- ip = Specify this tag as a direct child of the <system> tag
This tag would contain information about the IP of the remote machine on which you want your testcase to run
Eg: <ip>167.125.0.1</ip>
- remote = Specify this tag as a direct child of the <system> tag
This tag when set to set, would use the IP above and start up a browser on that machine. If this tag is set to ‘no’, a browser would launch on your machine
Eg: <remote>yes</remote>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child tag the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json file which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- ip(str) = IP of the remote machine
- remote(str) = ‘yes’ or ‘no’ to indicate whether you want to
- connect to the given aboveIP
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
browser_maximize
(system_name, type='firefox', browser_name='all')[source]¶ This will maximize the browser window.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
browser_refresh
(system_name, type='firefox', browser_name='all')[source]¶ This will refresh the browser window.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
browser_reload
(system_name, type='firefox', browser_name='all')[source]¶ This will reload the browser window.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
close_a_tab
(system_name, type='firefox', browser_name='all', tab_number=None, element_config_file=None, element_tag=None)[source]¶ This keyword will let you close an open tab.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- tab_number = This <tab_number> tag is a child og the <browser>
tag in the data file. This tag would contain the information about the tab number that you want to close
Eg: <tab_number>3</tab_number>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- tab_number (int/str) = The tab number that you want to close.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
This keyword will delete a particular cookie of a browser instance.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- cookie_name = This <cookie_name> tag is a child og the <browser>
tag in the data file. The name of the ccokie that you want to delete can be added here.
Eg: <cookie_name>gmail_cookie</cookie_name>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- cookie_name (str) = Name of the cookie that you want to delete
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
This keyword will delete all cookies of a browser instance.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
get_window_position
(system_name, type='firefox', browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword will return the window position.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
get_window_size
(system_name, type='firefox', browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword will return window size.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
This will take you backward in browser history.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
This will take you forward in the browser history.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
This will navigate the browser tab to given URL.
This keyword does not validate the url provided by the user. Please use navigate_to_url_with_verification if you need to verify the navigation result. ——————————————————————————
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
The webpage would be directed to the given URL and then whether the navigation was successful or not would be verified
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
- 7.locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- expected_value = This <expected_value> tag is a child og the
<browser> tag in the data file. This tag would contain the the value you expect the browser to have. This can be either a url, page title, page source, or page name
Eg: <expected_value>http://www.google.com</expected_value>
- value_type =This <value_type> tag is a child of the <browser>
tag in the data file. This tag would contain the type of browser information that you want to verify. It can either be current_url, title, name, or page_source
Eg: <value_type>title</value_type>
Please provide either the locator type and locator or provide value_type and expected_value for the verificationr to be performed successfully
- Note: Even though, current_url is an acceptable value_type, it is not recommended that
you use it since it can result in a false positive. Please use it only if you are sure that the verification would go through correctly.
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
- locator_type (str) = type of the locator - xpath, id, etc.
- locator (str) = locator by which the element should be located.
- expected_value (str) = The expected value of the information
- retrieved from the web page.
- value_type(str) = Type of page information that you wat to
- verify: current_url, name, title, or page_source
Returns: - status(bool)= True / False.
-
open_a_new_tab
(system_name, type='firefox', browser_name='all', element_config_file=None, element_tag=None, url=None)[source]¶ This will open a new tab.
DISCLAIMER - A new window will be opened for firefox as Selenium does not support tabs in Firefox.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
save_screenshot
(system_name, type='firefox', directory=None, filename=None, browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword will save a screenshot of the current browser window.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- directory = This <directory> tag is a child og the <browser> tag
in the data file. This tag would contain the information about the directory in which you want to store the screenshot. If left empty, the screenshots would be saved in the Logs directory
Eg: <directory>/home/user/screenshots</directory>
- filename = This <filename> tag is a child of the <browser> tag in
the data file. This tag would contain the information about the name of file that you want the screenshot to have. If left empty, the screenshot file would be saved with the name screenshot_*timestamp*
Eg: <filename>new_screenshot</filename>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/selenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- directory (str) = The directory that would store the
- screenshots.
- filename (str) = Name of the screenshot file
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
set_window_position
(system_name, xpos=None, ypos=None, type='firefox', browser_name='all', element_config_file=None, element_tag=None)[source]¶ This will set the browser window to a particular position.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- xpos = This <xpos> tag is a child og the <browser> tag in the
data file. This tag would contain the information about the x co-ordinate of the window
Eg: <xpos>500</xpos>
- ypos = This <ypos> tag is a child og the <browser> tag in the
data file. This tag would contain the information about the y co-ordinate of the window
Eg: <ypos>750</ypos>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- xpos (int/str) = The x co-ordinate
- ypos (int/str) = The y co-ordinate
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
set_window_size
(system_name, xsize=None, ysize=None, type='firefox', browser_name='all', element_config_file=None, element_tag=None)[source]¶ This will set the browser window to a particular size.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- xsize = This <xsize> tag is a child og the <browser> tag in the
data file. This tag would contain the information about the x co-ordinate of the window
Eg: <xsize>500</zsixe>
- ysize = This <ysize> tag is a child og the <browser> tag in the
data file. This tag would contain the information about the y co-ordinate of the window
Eg: <ysize>750</ysize>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- xsize (int/str) = The x co-ordinate
- ysize (int/str) = The y co-ordinate
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
switch_between_tabs
(system_name, type='firefox', browser_name='all', tab_number=None, element_config_file=None, element_tag=None)[source]¶ This keyword will let you switch between all open tabs.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- type = This <type> tag is a child og the <browser> tag in the
data file. The type of browser that should be opened can be added in here.
Eg: <type>firefox</type>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- tab_number = This <tab_number> tag is a child og the <browser>
tag in the data file. This tag would contain the information about the tab number that you want to switch to from the current tab
Eg: <tab_number>3</tab_number>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/slenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- tab_number (int/str) = The tab number that you want to switch to.
- type(str) = Type of browser: firefox, chrome, ie.
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
Actions.SeleniumActions.elementlocator_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.SeleniumActions.elementlocator_actions.
elementlocator_actions
[source]¶ Bases:
object
This is a class that deals with all ‘element’ (HTML element) related functionality like locating an element via its tag name, class name, name, id, css selector, partial and complete links.
-
get_element
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the given locator
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_classname
(system_name, class_name=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s class name
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- class_name = This contains the class name of the element that
you want to find.
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the class_name. So if class_name = x_class_name, then Warrior can search for an element with that class name
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_class_name, an child element of the element_tag with id as ‘class’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- class_name must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If class_name is given, then it would have priority. Otherwise, the element_config_file would be searched
The class_name and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- class_name(str) = class_name of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_id
(system_name, id=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s ID
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
id = This contains the id of the element that you want to find.
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the id. So if id = x_id, then Warrior can search for an element with that id
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_id, an child element of the element_tag with id as ‘id’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- id must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If id is given, then it would have priority. Otherwise, the element_config_file would be searched
The id and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- id(str) = id of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_link_text
(system_name, link_text=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s Link Text
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- link_text = This contains the link text of the element that
- you want to find.
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the link_text. So if link_text = x_link_text, then Warrior can search for an element with that link text
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_link_text, an child element of the element_tag with id as ‘link’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- link_text must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If link_text is given, then it would have priority. Otherwise, the element_config_file would be searched
The link_text and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- link_text(str) = link_text of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_name
(system_name, name_of_element=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s name
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- name_of_element = This contains the name of the element that you
- want to find.
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the name_of_element. So if name_of_element = x_name_of_element, then Warrior can search for an element with that name
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_name, an child element of the element_tag with id as ‘name’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- name_of_element must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If name_of_element is given, then it would have priority. Otherwise, the element_config_file would be searched
The name_of_element and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- name_of_element(str) = name_of_element of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_partial_link_text
(system_name, partial_link_text=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s Partial Link Text
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- partial_link_text = This contains the partial link text of the
- element that you want to find.
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the link_text. So if partial_link_text = x_partial_link_text, then Warrior can search for link element containing that text
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_link_text, an child element of the element_tag with id as ‘partial_link’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- partial_link_text must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If partial_link_text is given, then it would have priority. Otherwise, the element_config_file would be searched
The partial_link_text and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- partial_ink_text(str) = partial link text of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_selector
(system_name, css_selector=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s CSS selector
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- css_selector = This contains the css selector of the element that
you want to find.
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the id. So if css_selector = x_css_selector, then Warrior can search for an element with that css
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_selector, an child element of the element_tag with id as ‘css’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- css_selector must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If css_selector is given, then it would have priority. Otherwise, the element_config_file would be searched
The css_selector and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- css_selector(str) = css_selector of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_tagname
(system_name, tag_name=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s tag name
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- tag_name = This contains the tag name of the element that
you want to find.
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the tag_name. So if tag_name = x_tag_name, then Warrior can search for an element with that tag name
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_tag_name, an child element of the element_tag with id as ‘tag’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- tag_name must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If tag_name is given, then it would have priority. Otherwise, the element_config_file would be searched
The tag_name and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- tag_name(str) = tag_name of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
get_element_by_xpath
(system_name, xpath=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get an element by the element’s xpath
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- xpath = This contains the xpath of the element that you want to
find.
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the xpath. So if xpath = [some_xpath], then Warrior can search for an element with that xpath
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - get_element_by_xpath, an child element of the element_tag with id as ‘xpath’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- xpath must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If xpath is given, then it would have priority. Otherwise, the element_config_file would be searched
The xpath and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- xpath(str) = xpath of the element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
- output_dict(dict) = dictionary containing information about the
- browser
-
Actions.SeleniumActions.elementoperation_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.SeleniumActions.elementoperation_actions.
elementoperation_actions
[source]¶ Bases:
object
This is a class that deals with all ‘element’ (HTML element) related operations like clicking on an element, drag and drop of an element, hovering on an element
-
check_property_of_element
(system_name, attribute_name, property_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get property or attribute of the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- attribute_name = This contains information about the attribute
name of the element who’s property you want to verify.
- property_name = This contains information about the property you
want to verify.
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- attribute_name (str) = Name of the attribute
- property_name (str) = Name of the property
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
clear
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will clear any text, checks on the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
clear_text
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will clear text in the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
- locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
- “form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
click_an_element
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will simulate a click on the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
double_click_an_element
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will simulate a double-click on the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
drag_and_drop_an_element
(system_name, source_locator_type=None, source_locator=None, target_locator_type=None, target_locator=None, element_config_file=None, second_element_config_file=None, element_tag=None, second_element_tag=None, browser_name='all')[source]¶ This will simulate a drag and drop on the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- source_locator_type = This contains information about the type
of locator that you want to use to locate the source element that needs to dragged. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’, ‘class’, ‘name’
- source_locator = This contains the value of the locator of the
source element that needs to be dragged. Something like “form”, “nav-tags”, “//[dh./dhh[yby]”
- target_locator_type = This contains information about the type
of locator that you want to use to locate the target element where the source element needs to be dropped. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’, ‘class’, ‘name’
- target_locator = This contains the value of the locator that you
want to use to locate the target element where the source element needs to be dropped. Something like “form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the default
json file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the default element in
either of the element_config_files which you want to use
- second_element_config_file = This contains the location of the
second json file that you may want to use
- second_element_tag = This contains the name of the element in
either of the element_config_files which you want to use
USING SOURCE_LOCATOR_TYPE, LOCATOR, TARGET_LOCATOR_TYPE, TARGET_LOCATOR, ELEMENT_CONFIG_FILE, ELEMENT_TAG, SECOND_ELEMENT_CONFIG_FILE, AND SECOND_ELEMENT_TAG =================================================================
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the source/target_locator_type and source/target_locator. So if source/target_locator_type = name and source/target_locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_files and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the source/target_locator type is given, Warrior
will search for that source/target_locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_files, and now,
even if the source/target_locator_type is not given, Warrior will know which element to find. If source/target_locator_type is given, the default will be overridden
- If source/target_locator_type is not given, and the defaults are
not specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- source/target_locator_type and source/target_locator must be given
- source/target_locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if source/target_locator and source/target_locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The source/target_locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
The element_config_files and element_tags can be linked to one another as the example given below:
Eg:
- <step TS= ‘25’ Driver=’selenium_driver’ Keyword=’drag_and_drop_an_element’ >
- <Arguments>
- <argument name=”system_name” value=”system_1”/> <argument name=”source_locator_type” value=”element_tag=xpath”/> <argument name=”target_locator_type” value=”second_element_tag=xpath”/> <argument name=”element_config_file” value=”../Config_files/demo_selenium_tc_Config_1.json”/> <argument name=”second_element_config_file” value=”../Config_files/demo_selenium_tc_Config_2.json”/> <argument name=”element_tag” value=”element_config_file=source”/> <argument name=”second_element_tag” value=”second_element_config_file=target”/>
</Arguments>
</step>
Here, the source_locator_type will be searched for in the element_tag in the element_config_file, while the the target_locator_type will be searched for in the second_element_tag in the second_element_config_file
Arguments: - system_name(str) = the system name.
- source_locator_type(str) = type of the locator - xpath, id, etc
- for the source element
- source_locator(str) = locator by which the elemnt should be
- located for the source element
- target_locator_type(str) = type of the locator - xpath, id, etc
- for the target element
- target_locator(str) = locator by which the elemnt should be
- located for the target element
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
drag_and_drop_by_offset
(system_name, source_locator_type=None, source_locator=None, element_config_file=None, element_tag=None, xoffset=None, yoffset=None, browser_name='all')[source]¶ This will drag and drop the given element to the user provided x and y offset position :Datafile Usage:
Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- source_locator_type = This contains information about the type
of locator that you want to use to locate the source element that needs to dragged. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’, ‘class’, ‘name’
- source_locator = This contains the value of the locator of the
source element that needs to be dragged. Something like “form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the default
json file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the default element in
either of the element_config_files which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the source_locator_type and source_locator. So if source_locator_type = name and source_locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_files and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the source_locator type is given, Warrior
will search for that source_locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_files, and now,
even if the source_locator_type is not given, Warrior will know which element to find. If source_locator_type is given, the default will be overridden
- If source_locator_type is not given, and the defaults are
not specified, then the first element in the child list of the element tag would be picked. NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- source_locator_type and source_locator must be given
- source_locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if source_locator and source_locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The source_locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
The element_config_files and element_tags can be linked to one another as the example given below:
Eg:
- <step TS= ‘25’ Driver=’selenium_driver’ Keyword=’drag_and_drop_an_element’ >
- <Arguments>
- <argument name=”system_name” value=”system_1”/> <argument name=”source_locator_type” value=”element_tag=xpath”/> <argument name=”element_config_file” value=”../Config_files/demo_selenium_tc_Config_1.json”/> <argument name=”element_tag” value=”element_config_file=source”/> <argument name=”xoffset” value=”100”/> <argument name=”yoffset” value=”0”/>
</Arguments>
</step> Here, the source_locator_type will be searched for in the element_tag in the element_config_file
Arguments: - system_name(str) = the system name.
- source_locator_type(str) = type of the locator - xpath, id, etc
- for the source element
- source_locator(str) = locator by which the elemnt should be
- located for the source element
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
- xoffset = X offset to move to
- yoffset = Y offset to move to
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
execute_script
(system_name, user_script=None, browser_name='all')[source]¶ This will execute the user provided script :Datafile Usage:
Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
user_script = string containing javascript as argument
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
Arguments: - system_name(str) = the system name.
- user_script(str) = string containing javascript
- browser_name(str) = Unique name for this particular browser
Returns: - status(bool)= True / False.
-
fill_an_element
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, text='', browser_name='all')[source]¶ This will fill an element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- text = This would contain text that you want to type into any
element. This can be given as a child of the <browser> tag but that restricts you to only that text per browser instance. It is therefore recommended that you include this as an argument to the testcase step or include it as a child of a particular element_tag in the element_config_file
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
get_property_of_element
(system_name, attribute_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will get property or attribute of the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- attribute_name = This contains information about the attribute
name of the element who’s property you want to get.
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- attribute_name (str) = Name of the attribute
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
mouse_over
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will perform the mouse over operation in the given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute. <system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
perform_keypress
(system_name, keys, simultaneous='yes', element_config_file=None, element_tag=None, browser_name='all')[source]¶ This will simulate key presses for the given keys
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- keys = This argument takes in the keys whose keypresses need to
be simulated. It an be just one key - or if multiple keys are needed, then a comma separated list of keys
- Eg: f5
control, alt, delete
- simultaneous = When set to ‘yes’, all the key-presses for the
given keys would be performed simultaneously. When set to ‘no’, the key-presses for the keys would be simulated one after the other.
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
Arguments: - system_name(str) = the system name.
- keys (str) = The keys whose key-presses have to be simulated
- simultaneous (str) = Whether the keys given above should be
- pressed simultaneously or not
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
send_keys_to_an_element
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, text='', browser_name='all')[source]¶ This will send keys like ENTER, COMMAND, F1 to the element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- text = This would contain key like ENTER, CONTROL, ESCAPE - that
you want to type. This can be given as a child of the <browser> tag but that restricts you to only that text per browser instance. It is therefore recommended that you include this as an argument to the testcase step or include it as a child of a particular element_tag in the element_config_file
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
type_text
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, text='', browser_name='all')[source]¶ This will type text into a given element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- text = This would contain text that you want to type into any
element. This can be given as a child of the <browser> tag but that restricts you to only that text per browser instance. It is therefore recommended that you include this as an argument to the testcase step or include it as a child of a particular element_tag in the element_config_file
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
verify_text
(system_name, locator_type=None, locator=None, element_config_file=None, element_tag=None, var=None, expected=None, browser_name='all')[source]¶ This will get text in the given element and store in the data repository as var variable if specified else stores in “default” var and verify if it is same as expected if expected provided
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- locator_type = This contains information about the type of
- locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
- “form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
- file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
- element_config_file which you want to use
- var = variable name in data repository where this text will
- be stored. If not provided, would be stored in element_name got by system_name + “_” + browser_details[“browser_name”] + “_” + comp_locator
- expected = The expected value for this text. If not provided
- only the var would be stored in data repository but verification wont be done
None of these arguments are mandatory BUT to search an element or to retrieve it from the data repository, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the elemnt should be located.
- browser_name(str) = Unique name for this particular browser
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
- var(str) = name in which text would be stored in data repository
- if not provided, would be stored in element_name got by system_name + “_” + browser_details[“browser_name”] + “_” + comp_locator (optional)
- expected(str) = string to be verified with text (optional)
Returns: - status(bool)= True if expected is provided and it matches with
- text otherwise False.
-
Actions.SeleniumActions.verify_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.SeleniumActions.verify_actions.
verify_actions
[source]¶ Bases:
object
This class deals with functionality related to verifications that can be performed in a browser window - like verifying a page by its property (like url, title, page source, and name), verifying if an alert is present on the webpage
-
verify_alert_is_present
(system_name, action='accept', browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword will verify page by property.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- action = This contains the information of what action needs to
be performed on the alert. It can be either accept or dismiss. The default is accept.
Eg: <action>dismiss</action>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/selenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- actions(str) = action that needs to be performed on the alert
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
verify_page_by_property
(system_name, expected_value, value_type, browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword will verify page by property.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child og the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- url = The URL that you want to open your browser to can be added
in the <url> tag under the <browser> tag.
Eg: <url>https://www.google.com</url>
- expected_value = This <expected_value> tag is a child og the
<browser> tag in the data file. This tag would contain the the value you expect the browser to have. This can be either a url, page title, page source, or page name
Eg: <expected_value>http://www.google.com</expected_value>
- value_type = This <value_type> tag is a child of the <browser>
tag in the data file. This tag would contain the type of browser information that you want to verify. It can either be current_url, title, name, or page_source
Eg: <value_type>title</value_type>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/selenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- expected_value (str) = The expected value of the information
- retrieved from the web page.
- value_type (str) = Type of page information that you wat to
- verify: current_url, name, title, or page_source
- browser_name(str) = Unique name for this particular browser
- url(str) = URL to which the browser should be directed
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
verify_text_in_window_pane
(system_name, verification_text=None, browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword is to verify whether the user provided texts exist on the web page
Datafile Usage: Tags or attributes to be used in input data file for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the data file as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- verification_text = text to be verified in the web page should be given as a comma separated value
without any space in between, if it is multiple values Eg. <verification_text>Gmail,Google</verification_text>
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the test case execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the verification_text. So if verification_text = verification_text(comma seperated values), then Warrior can search the given verification_text in the window pane
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there. Now, as this is the keyword - verify_text_in_window_pane, an child element of the element_tag with id as ‘verification_text’ would be searched for in the element_config_file
- NOTES:
For these three arguments to be given correctly, ONE of the following conditions must be satisfied.
- verification_text must be given
- element_config_file, and element_tag must be given
The data file has the first priority, then the json file, and then finally the test case.
If name_of_element is given, then it would have priority. Otherwise, the element_config_file would be searched
The name_of_element and the element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the test case step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- verification_text = text to be verified in the webpage
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
Actions.SeleniumActions.wait_actions module¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
Actions.SeleniumActions.wait_actions.
wait_actions
[source]¶ Bases:
object
This class has the functionality to wait till an event has happened on the webpage - such as the browser will wait till an element is clickable, visible, or present on a webpage. Implicit wait can also be set for a webpage with this class
-
set_implicit_wait
(system_name, timeout, browser_name='all', element_config_file=None, element_tag=None)[source]¶ This keyword would permanently set the implicit wait time for given browser instance(s)
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for any action to be performed on it
Eg: <timeout>15</timeout>
- element_config_file = This <element_config_file> tag is a child
of the <browser> tag in the data file. This stores the location of the element configuration file that contains all element locators.
- Eg: <element_config_file>
../Config_files/selenium_config.json </element_config_file>
- element_tag = This element_tag refers to a particular element in
the json fie which contains relevant information to that element. If you want to use this one element through out the testcase for a particular browser, you can include it in the data file. If this not the case, then you should create an argument tag in the relevant testcase step and add the value directly in the testcase step.
FOR DATA FILE Eg: <element_tag>json_name_1</element_tag>
FOR TEST CASE Eg: <argument name=”element_tag” value=”json_name_1”>
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- element_config_file (str) = location of the element configuration
- file that contains all element locators
- element_tag (str) = particular element in the json fie which
- contains relevant information to that element
Returns: - status(bool)= True / False.
-
wait_until_element_is_clickable
(system_name, timeout=5, locator=None, locator_type=None, browser_name='all', element_tag=None, element_config_file=None)[source]¶ This keyword would check whether an element is visible and enabled such that we can click on the element
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for the element to become clickable
Eg: <timeout>15</timeout>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
wait_until_presence_of_all_elements_located
(system_name, timeout=5, locator=None, locator_type=None, browser_name='all', element_tag=None, element_config_file=None)[source]¶ This keyword would check whether all the elements is present on the DOM of a page
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for all the elemnts to be located
Eg: <timeout>15</timeout>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
wait_until_presence_of_element_located
(system_name, timeout=5, locator=None, locator_type=None, browser_name='all', element_tag=None, element_config_file=None)[source]¶ This keyword would check whether an element is present on the DOM of a page
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for the element to be located
Eg: <timeout>15</timeout>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
wait_until_visibility_is_determined
(system_name, timeout='5', locator=None, locator_type=None, browser_name='all', element_tag=None, element_config_file=None)[source]¶ This keyword would check whether an element, known to be present on the DOM of a page, is visible
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for an element known to exist in the DOM to become visible
Eg: <timeout>15</timeout>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
wait_until_visibility_of_element_located
(system_name, timeout='5', locator=None, locator_type=None, browser_name='all', element_tag=None, element_config_file=None)[source]¶ This keyword would check whether an element is present on the DOM of a page and visible.
Datafile Usage: Tags or attributes to be used in input datafile for the system or subsystem. If both tag and attribute is provided the attribute will be used.
- system_name = This attribute can be specified in the datafile as
a <system> tag directly under the <credentials> tag. An attribute “name” has to be added to this tag and the value of that attribute would be taken in as value to this keyword attribute.
<system name=”name_of_thy_system”/>
- browser_name = This <browser_name> tag is a child of the
<browser> tag in the data file. Each browser instance should have a unique name. This name can be added here
Eg: <browser_name>Unique_name_1</browser_name>
- timeout = This contains the information of how much time the
browser needs to wait for an element whose existence in the DOM is unknown to become visible
Eg: <timeout>15</timeout>
- locator_type = This contains information about the type of
locator that you want to use. Can be ‘xpath’, ‘id’, ‘css’, ‘link’, ‘tag’,’class’, ‘name’
- locator = This contains the value of the locator. Something like
“form”, “nav-tags”, “//[dh./dhh[yby]”
- element_config_file = This contains the location of the json
file that contains information about all the elements that you require for the testcase execution
- element_tag = This contains the name of the element in that
element_config_file which you want to use
None of these arguments are mandatory BUT to search an element, you need to provide Warrior with some way to do it.
a. You can either directly give values for the locator_type and locator. So if locator_type = name and locator = navigation-bar, then Warrior can search for an element with name “navigation-bar”
b. You can give location of the element_config_file and a tag inside it so that Warrior can search for that tag and get the required information from there.
- Now, if the locator type is given, Warrior
will search for that locator_type in the children of that element in the element_config_file
- You can also set defaults in the element_config_file, and now,
even if the locator_type is not given, Warrior will know which element to find. If locator_type is given, the default will be overridden
- If locator_type is not f=given, and the defaults are not
specified, then the first element in the child list of the element tag would be picked.
- NOTES:
For these four arguments to be given correctly, ONE of the following conditions must be satisfied.
- locator_type and locator must be given
- locator_type, element_config_file, and element_tag must be given
- element_config_file, and element_tag must be given
The datafile has the first priority, then the json file, and then finally the testcase.
If all arguments are passed from the same place, then, if locator and locator_type are given, then they would have priority. Otherwise, the element_config_file would be searched
The locator_type locator, element_tag can be given the datafile as children of the <browser> tag, but these values would remain constant for that browser. It is recommended that these values be passed from the testcase step.
The element_config_file typically would not change from step to step, so it can be passed from the data file
Arguments: - system_name(str) = the system name.
- browser_name(str) = Unique name for this particular browser
- timeout(str) = amount of time the browser should wait
- locator_type(str) = type of the locator - xpath, id, etc.
- locator(str) = locator by which the element should be located.
- element_config_file(str) = location of the element config file
- element_tag(str) = json id of the locator that you want to use
- from the element config file
Returns: - status(bool)= True / False.
-
Module contents¶
Copyright 2017, Fujitsu Network Communications, Inc. Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.