1
1
1slesar72020-03-16 17:22:31
Python
1slesar7, 2020-03-16 17:22:31

Xpath syntax: strings, numbers, variables, functions?

Gentlemen, there are clickable buttons on the website of the form: xpath("//button[contains(text(),'+5')]"), the numbers can be different. Is it possible to use a variable instead, or convert the string '+5' to a number in order to click() on the desired button, for example if >= +20?
ps
I will put a question on another.
Algorithm of actions:
1. Open the page
2. Click the button with a certain condition, for example >= 10
3. The list opens on the same page
4. Click the button with a certain condition, for example >= 1
5. Close the list by clicking the same button from the item 2
6. We click another button with the same condition from point 2, performing the actions of points 3, 4, 5.
So we do, for example, 10 times.
Explain schematically the algorithm of a python program. Understood with xpath.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-03-16
@dimonchik2013

with Xpath 2.0 you can use regular expressions
https://www.w3.org/TR/xpath-functions/#func-matches
can you handle it further?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question