@@ -261,6 +261,10 @@ def click_link_text(self, link_text, timeout=settings.SMALL_TIMEOUT):
261
261
else :
262
262
self ._demo_mode_pause_if_active (tiny = True )
263
263
264
+ def click_link (self , link_text , timeout = settings .SMALL_TIMEOUT ):
265
+ """ Same as self.click_link_text() """
266
+ self .click_link_text (link_text , timeout = timeout )
267
+
264
268
def click_partial_link_text (self , partial_link_text ,
265
269
timeout = settings .SMALL_TIMEOUT ):
266
270
""" This method clicks the partial link text on a page. """
@@ -343,6 +347,9 @@ def get_attribute(self, selector, attribute, by=By.CSS_SELECTOR,
343
347
timeout = self ._get_new_timeout (timeout )
344
348
if page_utils .is_xpath_selector (selector ):
345
349
by = By .XPATH
350
+ if page_utils .is_link_text_selector (selector ):
351
+ selector = page_utils .get_link_text_from_selector (selector )
352
+ by = By .LINK_TEXT
346
353
self .wait_for_ready_state_complete ()
347
354
time .sleep (0.01 )
348
355
element = page_actions .wait_for_element_present (
@@ -516,11 +523,17 @@ def update_text(self, selector, new_value, by=By.CSS_SELECTOR,
516
523
def is_element_present (self , selector , by = By .CSS_SELECTOR ):
517
524
if page_utils .is_xpath_selector (selector ):
518
525
by = By .XPATH
526
+ if page_utils .is_link_text_selector (selector ):
527
+ selector = page_utils .get_link_text_from_selector (selector )
528
+ by = By .LINK_TEXT
519
529
return page_actions .is_element_present (self .driver , selector , by )
520
530
521
531
def is_element_visible (self , selector , by = By .CSS_SELECTOR ):
522
532
if page_utils .is_xpath_selector (selector ):
523
533
by = By .XPATH
534
+ if page_utils .is_link_text_selector (selector ):
535
+ selector = page_utils .get_link_text_from_selector (selector )
536
+ by = By .LINK_TEXT
524
537
return page_actions .is_element_visible (self .driver , selector , by )
525
538
526
539
def is_link_text_visible (self , link_text ):
@@ -961,6 +974,9 @@ def wait_for_element_present(self, selector, by=By.CSS_SELECTOR,
961
974
timeout = self ._get_new_timeout (timeout )
962
975
if page_utils .is_xpath_selector (selector ):
963
976
by = By .XPATH
977
+ if page_utils .is_link_text_selector (selector ):
978
+ selector = page_utils .get_link_text_from_selector (selector )
979
+ by = By .LINK_TEXT
964
980
return page_actions .wait_for_element_present (
965
981
self .driver , selector , by , timeout )
966
982
@@ -986,6 +1002,9 @@ def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
986
1002
The element must be visible (it cannot be hidden). """
987
1003
if page_utils .is_xpath_selector (selector ):
988
1004
by = By .XPATH
1005
+ if page_utils .is_link_text_selector (selector ):
1006
+ selector = page_utils .get_link_text_from_selector (selector )
1007
+ by = By .LINK_TEXT
989
1008
return page_actions .wait_for_element_visible (
990
1009
self .driver , selector , by , timeout )
991
1010
@@ -1024,6 +1043,9 @@ def wait_for_text_visible(self, text, selector, by=By.CSS_SELECTOR,
1024
1043
timeout = self ._get_new_timeout (timeout )
1025
1044
if page_utils .is_xpath_selector (selector ):
1026
1045
by = By .XPATH
1046
+ if page_utils .is_link_text_selector (selector ):
1047
+ selector = page_utils .get_link_text_from_selector (selector )
1048
+ by = By .LINK_TEXT
1027
1049
return page_actions .wait_for_text_visible (
1028
1050
self .driver , text , selector , by , timeout )
1029
1051
@@ -1152,6 +1174,9 @@ def wait_for_element_not_visible(self, selector, by=By.CSS_SELECTOR,
1152
1174
timeout = self ._get_new_timeout (timeout )
1153
1175
if page_utils .is_xpath_selector (selector ):
1154
1176
by = By .XPATH
1177
+ if page_utils .is_link_text_selector (selector ):
1178
+ selector = page_utils .get_link_text_from_selector (selector )
1179
+ by = By .LINK_TEXT
1155
1180
return page_actions .wait_for_element_not_visible (
1156
1181
self .driver , selector , by , timeout )
1157
1182
0 commit comments