-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select specific row in html table - try out these ideas to do (checking text or attribute) #1086
Comments
Hi @andrei152515 an easy way would be using read step to get the text into a variable, then check before deleting.
Above can then be wrapped in a for loop to process all the records, using this XPath syntax |
Other than visually inspecting the HTML code, Chrome extension like SelectorsHub can be very helpful to find XPath. |
Hi @kensoh If I delete the first product, tagui will not delete the second one, because #2 will become #1 and the for loop at that time is passed from the step #1 which delete the first out of stock product and in this way I will get only 2 products deleted instead of 3. Thank you so much. |
Hi @andrei152515 I'm bringing in my team-mate @ruthtxh to look at this. This is an interesting scenario, I thought if more people can look into this a better solution can be found. |
Hi @andrei152515
|
This is a great idea - I'm not sure if the for loops in TagUI can accept direct decrements of the variables, but is worth trying! |
hi @ruthtxh, thank you for your suggestion, but is not working. The reason, I think, is because 'for' is using the first count and do not take into account the decrementing. Below I will attach the code that I'm using, and the results, to have a better idea of what I'm trying to do: number_items=count('//[@Class="table table-bordered"]//[@Class="text-center"]') - 1 for (item=1; item<number_items; item++) The total number of items in the list is 5, and 3 of them are out of stock. What about to read all the rows where I have "***" and after I have all the information, in variables, delete the specific rows, in the end? |
@andrei152515 hello, can you share the website url? |
hi @marcelocecin, unfortunately is on localhost |
and the html code? |
The website is based on Opencart. This is the cart page: |
try to use this XPath
|
Hi Marcelo, this looks like a brilliant solution! If the removal has some processing time, @andrei152515 can add a wait after deleting for page to refresh before loop again. |
hi @marcelocecin, very good idea, helped me a lot, with just a small rectification: total_items = count('//span[text()=""]') For, 'click', instead of n is working with 1. If there is Thank you. |
Hi, i'm new to tagui and i'm trying to select a specific row in an html table.
![image](https://user-images.githubusercontent.com/87833471/126710051-1710f24f-3e41-45e4-ab7e-67f2775d731c.png)
I have a table on a website and i want to delete a specific row where a specific class (text-danger) is present.
example below.
I want to delete the specific products which are out of stock.
![image](https://user-images.githubusercontent.com/87833471/126710366-27414147-08e3-4a49-8322-38c29e611a33.png)
for the example shown the html code is:
Can someone help me please ?
Thank you :)
The text was updated successfully, but these errors were encountered: