Selenium XPath Tutorial #4 - XPath Contains Function with Examples

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ • 13

  • @manoj_mafiosi
    @manoj_mafiosi Рік тому +6

    **Exploring the "contains" Function in XPath - Notes:**
    - Introduction:
    - Similar to "starts-with," useful for locating dynamic web elements.
    - Scenario:
    - Web elements with attributes that change with page refresh.
    - Attribute may contain a static part followed by a dynamic part.
    - Using the "contains" Function:
    - Format: double forward slash for relative XPath, followed by the tag name in square brackets.
    - Use "contains(@attribute, 'partial_value')" to locate dynamic web elements.
    - Advantages: Specify any part of the attribute value (start, middle, end).
    - Example:
    - To locate input elements with the name attribute containing "user":
    - XPath: "input[contains(@name, 'user')]".
    - Test Execution:
    - The test opens the browser, types in the dummy email, and closes it, passing the test successfully.
    - Conclusion:
    - "Contains" function in XPath is valuable for locating dynamic web elements.
    - It allows specifying partial attribute values to identify desired elements.
    - Combining "contains" with "starts-with" can enhance automation framework efficiency.

  • @zahidukalayev4404
    @zahidukalayev4404 3 роки тому +1

    MASHALLAH SUPER EXPLAIN. THANKS A LOT

  • @TheAllanazarpour
    @TheAllanazarpour 4 роки тому +2

    Subscribed and enrolled, thank you.

  • @KrisuParikh
    @KrisuParikh Місяць тому

    thank you

  • @sufails6990
    @sufails6990 4 роки тому +2

    amazing explanation ,,Thank you so much sir

  • @safaboi203
    @safaboi203 2 роки тому

    Thank you sir. I will share to help out :)

  • @studiesonsoftwaretesting9768
    @studiesonsoftwaretesting9768 3 роки тому

    thank you for the video

  • @harikag398
    @harikag398 2 роки тому +1

    Hi Sir, If the value is variable type then how could we find with the contains function. '(//div[contains(text(), value)])'
    Here in my program "value" is not constant.Everytime i need to take value from for loop. Please let me know how to find text value if it is in variable mode

  • @sunandabamnalli5965
    @sunandabamnalli5965 2 роки тому

    Hi Sir, Thank you so much for such an amazing idea about robot,
    I have started writing script using robot framework, I was lagging on UnexpectedAlertPresentException occurs, i'm very new to handle this exception so please upload a video about Handling exception on pycharm

  • @rkrk5378
    @rkrk5378 3 роки тому

    how to find an xath with text using contains