Skip to content

Commit

Permalink
replacing dispatch event with regular click to make it work with all …
Browse files Browse the repository at this point in the history
…clicks
  • Loading branch information
shriyanshagnihotri committed Nov 19, 2024
1 parent f1c4ac6 commit a69ea01
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions testzeus_hercules/core/tools/click_using_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,20 @@ async def perform_javascript_click(
view: window,
button: 0 // 0 represents the left mouse button
});
element.dispatchEvent(event);
// hack added to make sure that if dispatchevent is not working,
// we will try to click the element but in case if it worked there is no way to find out if it worked so do it odd time.
// this hack helps to deal with both salesforce type missing click and hamburger menu type missing click.
// element.dispatchEvent(event);
// element.dispatchEvent(event);
element.click();
// Check if the element is interactable
}
let ariaExpandedAfterClick = element.getAttribute('aria-expanded');
ariaExpandedAfterClick = element.getAttribute('aria-expanded');
if (ariaExpandedBeforeClick === 'false' && ariaExpandedAfterClick === 'true') {
return "Executed " + type_of_click + " on element with selector: " + selector + ". Very important: As a consequence, a menu has appeared where you may need to make further selection. Very important: Get all_fields DOM to complete the action.";
}
Expand Down

0 comments on commit a69ea01

Please sign in to comment.