Skip to content

Commit

Permalink
Merge pull request #167 from qentinelqi/tko_fix_all_frames_element_type
Browse files Browse the repository at this point in the history
Tko fix all frames element type
  • Loading branch information
tkoukkari authored Oct 11, 2024
2 parents 94384f7 + 2264b67 commit c492684
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions QWeb/internal/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ def _get_item_by_css(text: str, **kwargs) -> Optional[list[WebElement]]:
"a, span, img, li, h1, h2, h3, h4, h5, h6, div, svg, p, button, input"
':not([type="text"]):not([type="password"]):not([type="email"])'
)
# get_elements_by_attributes already handles going through frames
kwargs["continue_search"] = False
full, partial = element.get_elements_by_attributes(css, text, **kwargs)
web_elements = element.get_visible_elements_from_elements(full + partial, **kwargs)
if web_elements:
Expand Down
3 changes: 3 additions & 0 deletions QWeb/keywords/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ def get_attribute(
----------------
\`VerifyAttribute\`, \`VerifyElement\`
"""
# remove all_frames from kwargs if given. It's not supported by
# GetAttribute, but would give error later
kwargs.pop("all_frames", None)
webelement = get_webelement(locator, anchor, element_type, timeout, all_frames=False, **kwargs)

if not webelement:
Expand Down
22 changes: 20 additions & 2 deletions test/acceptance/parallel/frame.robot
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,35 @@ Upload with xpath
ShouldBeEqual ${value} C:\fakepath\test2.txt

GetTextCount and VerifyTextCount from multiple frames
[Tags] Frame Upload
[Tags] Frame
${count}= GetTextCount text
Should Be Equal As Numbers ${count} 15
VerifyTextCount Text 7

GetWebelement from multiple frames
[Tags] Frame Upload
[Tags] Frame
${elems}= GetWebElement //button all_frames=False
${count_one_frame}= Evaluate len($elems)
${elems}= GetWebElement //button
${count_all_frames}= Evaluate len($elems)
Should Be Equal As Numbers ${count_one_frame} 1
Should Be Equal As Numbers ${count_all_frames} 7


GetWebelement & GetAttribute from multiple frames with element type
[Tags] Frame Get
# Without all_frames
${elem1}= GetWebElement Blue element_type=item tag=input
${attr1}= GetAttribute Blue id element_type=item tag=input
${elem2}= GetWebElement Button1 element_type=text
${attr2}= GetAttribute skimClick disable button id element_type=text
ShouldBeEqual ${attr1} ch_1_1
ShouldBeEqual ${attr2} skimclick

# With all_frames, note that all_frames is not even supported in GetAttribute
${elem1}= GetWebElement Blue element_type=item tag=input all_frames=True
${attr1}= GetAttribute Blue id element_type=item tag=input all_frames=True
${elem2}= GetWebElement Button1 element_type=text all_frames=True
${attr2}= GetAttribute skimClick disable button id element_type=text all_frames=True
ShouldBeEqual ${attr1} ch_1_1
ShouldBeEqual ${attr2} skimclick

0 comments on commit c492684

Please sign in to comment.