File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -658,6 +658,24 @@ def activate_jquery(self):
658
658
# Since jQuery still isn't activating, give up and raise an exception
659
659
raise Exception ("Exception: WebDriver could not activate jQuery!" )
660
660
661
+ def bring_to_front (self , selector , by = By .CSS_SELECTOR ):
662
+ """ Updates the Z-index of a page element to bring it into view.
663
+ Useful when getting a WebDriverException, such as the one below:
664
+ { Element is not clickable at point (#, #).
665
+ Other element would receive the click: ... } """
666
+ if page_utils .is_xpath_selector (selector ):
667
+ by = By .XPATH
668
+ self .find_element (selector , by = by , timeout = settings .SMALL_TIMEOUT )
669
+ try :
670
+ selector = self .convert_to_css_selector (selector , by = by )
671
+ except Exception :
672
+ # Don't perform action if can't convert to CSS_SELECTOR for jQuery
673
+ return
674
+
675
+ script = ("""document.querySelector('%s').style.zIndex = "1";"""
676
+ % selector )
677
+ self .execute_script (script )
678
+
661
679
def highlight (self , selector , by = By .CSS_SELECTOR ,
662
680
loops = settings .HIGHLIGHTS , scroll = True ):
663
681
""" This method uses fancy javascript to highlight an element.
You can’t perform that action at this time.
0 commit comments