Unable to sort Alphabetically, Ascending or descending order when i select a drop down

learning

#1

I am trying to sort the element after i select drop down for alphabetically, ascending and descending order also in relevance it should be back
Currently i may not be able to use select as it throws an error and i feel its bootstrap so unable to to do it. I was using List and its also not picking. Finding a Xpath and navigate to next element is challenging as i tried to store in an Array.

I am attaching few screen shot. Kindly help !!!

This Image is the one which i am trying to select drop down

This are elements which gets sorted and i can use that unique number captured to know sort works or not

My HTML Code is attached below where you can see the first element


#2

There’s not much help from that “HTML” (note the quotes).

Sthil? Home Depot? They’re using obsolete HTML elements. Not just deprecated, actually obsolete.

You should advise the developers to use HTML standards. Testing is about ensuring quality. You can’t even get started with this poor HTML.


#3

Thanks Russ.

I’m new to automation and Katalon. What you mean by obsolete do you mean they can write better HTML for testers to identify elements. Is this causing for us to identify elements ? Can you elaborate sorry I’m new to this hence it might be very basic question.


#4

I understood what your refering let me catch up with the developer.
One question i agree using Obsolete is not a good practice still can we automate using this code.
I am trying to check with developer how we can improve it.


#5

This is not valid HTML:

image

That would put me in an awkward position. I would not write a test for HTML like this, I would fail it immediately for the reasons I stated. If I write code to help you, what am I doing? Making my skills, experience and advice worthless.

If your testing skills are to be worth anything, you need to talk with the developers about what it is they are trying to achieve. Writing a test that passes for invalid HTML is meaningless.

Also, if you write a test that passes this HTML, and then the developers fix their code, now you have to write the test again. If it is their intention to just keep you occupied and busy, that’s fine, I guess. But I’m not prepared to partner you in doing that. Sorry.

Maybe someone else is willing to spend the time.

(@Mate_Mrse, @Andrej_Podhajsky, @hpulsford, @Marek_Melocik)


#6

Hi Russ,

Actually the html content is like this below i dont know why the ‘font’ tag came which i agree with you its obsolete… and i think below is accepted to latest HTML . Kindly advice

@Russ_Thomas


#7

That HTML does not produce the dropdown.

Right-click on the dropdown, then choose “Inspect”.


#8

Hi Russ,

Please find below

@Russ_Thomas


#9

So you need to use WebUI.click() method to target the button element you highlighted.

You will need to create a TestObject for each button element.


#10

Hi Russ,

My objective is to click each of the element and view the elements (products) are sorted alphabetically , ascending or descending order. Can I know a List will work here and if I take the elements in List doest is sort alphabetically automatically or do I need any other functions or class.


#11

Yes. You will need to use a loop to click the dropdown options and then check the page elements are displayed accordingly.