Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SeleniumLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class SeleniumLibrary(DynamicCore):
used to specify multiple locators. This is useful, is some part of locator would match as the locator separator
but it should not. Or if there is need to existing WebElement as locator.

Although all locators support chaining, some locator strategies do not abey the chaining. This is because
Although all locators support chaining, some locator strategies do not obey the chaining. This is because
some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context
and not for the element found be the previous locator. Chaining is supported by locator strategies which
are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery
Expand Down
100 changes: 50 additions & 50 deletions src/SeleniumLibrary/keywords/element.py

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions src/SeleniumLibrary/keywords/formelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

import os
from typing import Optional, Union
from typing import Optional, Union, List

from robot.libraries.BuiltIn import BuiltIn
from selenium.webdriver.remote.webelement import WebElement
Expand All @@ -26,7 +26,7 @@

class FormElementKeywords(LibraryComponent):
@keyword
def submit_form(self, locator: Union[WebElement, None, str] = None):
def submit_form(self, locator: Union[WebElement, None, str, List[Union[WebElement,str]]] = None):
"""Submits a form identified by ``locator``.

If ``locator`` is not given, first form on the page is submitted.
Expand All @@ -41,7 +41,7 @@ def submit_form(self, locator: Union[WebElement, None, str] = None):
element.submit()

@keyword
def checkbox_should_be_selected(self, locator: Union[WebElement, str]):
def checkbox_should_be_selected(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
"""Verifies checkbox ``locator`` is selected/checked.

See the `Locating elements` section for details about the locator
Expand All @@ -55,7 +55,7 @@ def checkbox_should_be_selected(self, locator: Union[WebElement, str]):
)

@keyword
def checkbox_should_not_be_selected(self, locator: Union[WebElement, str]):
def checkbox_should_not_be_selected(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
"""Verifies checkbox ``locator`` is not selected/checked.

See the `Locating elements` section for details about the locator
Expand All @@ -69,7 +69,7 @@ def checkbox_should_not_be_selected(self, locator: Union[WebElement, str]):
@keyword
def page_should_contain_checkbox(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -86,7 +86,7 @@ def page_should_contain_checkbox(
@keyword
def page_should_not_contain_checkbox(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -101,7 +101,7 @@ def page_should_not_contain_checkbox(
self.assert_page_not_contains(locator, "checkbox", message, loglevel)

@keyword
def select_checkbox(self, locator: Union[WebElement, str]):
def select_checkbox(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
"""Selects the checkbox identified by ``locator``.

Does nothing if checkbox is already selected.
Expand All @@ -115,7 +115,7 @@ def select_checkbox(self, locator: Union[WebElement, str]):
element.click()

@keyword
def unselect_checkbox(self, locator: Union[WebElement, str]):
def unselect_checkbox(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
"""Removes the selection of checkbox identified by ``locator``.

Does nothing if the checkbox is not selected.
Expand All @@ -131,7 +131,7 @@ def unselect_checkbox(self, locator: Union[WebElement, str]):
@keyword
def page_should_contain_radio_button(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -149,7 +149,7 @@ def page_should_contain_radio_button(
@keyword
def page_should_not_contain_radio_button(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand Down Expand Up @@ -213,7 +213,7 @@ def select_radio_button(self, group_name: str, value: str):
element.click()

@keyword
def choose_file(self, locator: Union[WebElement, str], file_path: str):
def choose_file(self, locator: Union[WebElement, str, List[Union[WebElement,str]]], file_path: str):
"""Inputs the ``file_path`` into the file input field ``locator``.

This keyword is most often used to input files into upload forms.
Expand All @@ -240,7 +240,7 @@ def choose_file(self, locator: Union[WebElement, str], file_path: str):

@keyword
def input_password(
self, locator: Union[WebElement, str], password: str, clear: bool = True
self, locator: Union[WebElement, str, List[Union[WebElement,str]]], password: str, clear: bool = True
):
"""Types the given password into the text field identified by ``locator``.

Expand Down Expand Up @@ -270,7 +270,7 @@ def input_password(

@keyword
def input_text(
self, locator: Union[WebElement, str], text: str, clear: bool = True
self, locator: Union[WebElement, str, List[Union[WebElement,str]]], text: str, clear: bool = True
):
"""Types the given ``text`` into the text field identified by ``locator``.

Expand Down Expand Up @@ -299,7 +299,7 @@ def input_text(
@keyword
def page_should_contain_textfield(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -316,7 +316,7 @@ def page_should_contain_textfield(
@keyword
def page_should_not_contain_textfield(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -333,7 +333,7 @@ def page_should_not_contain_textfield(
@keyword
def textfield_should_contain(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
expected: str,
message: Optional[str] = None,
):
Expand All @@ -357,7 +357,7 @@ def textfield_should_contain(
@keyword
def textfield_value_should_be(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
expected: str,
message: Optional[str] = None,
):
Expand All @@ -381,7 +381,7 @@ def textfield_value_should_be(
@keyword
def textarea_should_contain(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
expected: str,
message: Optional[str] = None,
):
Expand All @@ -405,7 +405,7 @@ def textarea_should_contain(
@keyword
def textarea_value_should_be(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
expected: str,
message: Optional[str] = None,
):
Expand All @@ -429,7 +429,7 @@ def textarea_value_should_be(
@keyword
def page_should_contain_button(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -450,7 +450,7 @@ def page_should_contain_button(
@keyword
def page_should_not_contain_button(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
message: Optional[str] = None,
loglevel: str = "TRACE",
):
Expand All @@ -469,7 +469,7 @@ def page_should_not_contain_button(
def _get_value(self, locator, tag):
return self.find_element(locator, tag).get_attribute("value")

def _get_checkbox(self, locator: Union[WebElement, str]):
def _get_checkbox(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
return self.find_element(locator, tag="checkbox")

def _get_radio_buttons(self, group_name):
Expand Down
8 changes: 4 additions & 4 deletions src/SeleniumLibrary/keywords/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# 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.
from typing import Union
from typing import Union, List

from selenium.webdriver.remote.webelement import WebElement

Expand All @@ -22,7 +22,7 @@

class FrameKeywords(LibraryComponent):
@keyword
def select_frame(self, locator: Union[WebElement, str]):
def select_frame(self, locator: Union[WebElement, str, List[Union[WebElement,str]]]):
"""Sets frame identified by ``locator`` as the current frame.

See the `Locating elements` section for details about the locator
Expand Down Expand Up @@ -82,7 +82,7 @@ def current_frame_should_not_contain(self, text: str, loglevel: str = "TRACE"):

@keyword
def frame_should_contain(
self, locator: Union[WebElement, str], text: str, loglevel: str = "TRACE"
self, locator: Union[WebElement, str, List[Union[WebElement,str]]], text: str, loglevel: str = "TRACE"
):
"""Verifies that frame identified by ``locator`` contains ``text``.

Expand All @@ -99,7 +99,7 @@ def frame_should_contain(
)
self.info(f"Frame '{locator}' contains text '{text}'.")

def _frame_contains(self, locator: Union[WebElement, str], text: str):
def _frame_contains(self, locator: Union[WebElement, str, List[Union[WebElement,str]]], text: str):
element = self.find_element(locator)
self.driver.switch_to.frame(element)
self.info(f"Searching for text from frame '{locator}'.")
Expand Down
4 changes: 2 additions & 2 deletions src/SeleniumLibrary/keywords/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from typing import Optional, Union
from typing import Optional, Union, List
from base64 import b64decode

from robot.utils import get_link_path
Expand Down Expand Up @@ -146,7 +146,7 @@ def _capture_page_screen_to_log(self, return_val):
@keyword
def capture_element_screenshot(
self,
locator: Union[WebElement, str],
locator: Union[WebElement, str, List[Union[WebElement,str]]],
filename: str = DEFAULT_FILENAME_ELEMENT,
) -> str:
"""Captures a screenshot from the element identified by ``locator`` and embeds it into log file.
Expand Down
Loading
Loading