Procházet zdrojové kódy

fixes xpath to also find text in anchors

Rodja Trappe před 2 roky
rodič
revize
93ede59a71
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      tests/screen.py

+ 1 - 1
tests/screen.py

@@ -124,7 +124,7 @@ class Screen:
 
 
     def find(self, text: str) -> WebElement:
     def find(self, text: str) -> WebElement:
         try:
         try:
-            query = f'//*[not(self::script) and not(self::style) and contains(text(), "{text}")]'
+            query = f'//*[not(self::script) and not(self::style) and text()[contains(., "{text}")]]'
             element = self.selenium.find_element(By.XPATH, query)
             element = self.selenium.find_element(By.XPATH, query)
             if not element.is_displayed():
             if not element.is_displayed():
                 self.wait(0.1)  # HACK: repeat check after a short delay to avoid timing issue on fast machines
                 self.wait(0.1)  # HACK: repeat check after a short delay to avoid timing issue on fast machines