mercredi 30 septembre 2020

Why selenium can't find some text on page

I have some page and "tree menu". When I want to open tree_menu, I need to click on button. After, I make some steps and click on title, for example, I clicked "19,20", after I clicked "may" and after I clicked "2" and in the top of page (where i choose this tree_menu) I have a button/link. And text in this element with 2 space (not one):

"19,20 > may > 2"

But on display I think I see with 1 space, but in tag value with 2. And this ">" is text, but I don't know how it understands and sees selenium.

So, after I call my function for search this text:

    def isText(self, text):
        try:
            element = self.driver.find_element(By.XPATH, "//*[text()[contains(., \"" + text + "\")]]")
            return True
        except:
            return False

So, but selenium can't to find this text. And it could find only for "19,20", but space or next text - no. I opened web-code, but I didn't see new tag or something else.

But I tried find this button/link like element and check that text and it worked. This project work with dojo, but i can't to change anything.

Please, can you help me with this problem?

TY! Have a good day!

Aucun commentaire:

Enregistrer un commentaire