Element should have been "select" but was "div"

Hello,

When running a test, I’m getting this error “Element should have been “select” but was “div”” I used the spy feature when creating my element, I’m using Select option by label and created a variable as well and I’m still getting this error here are my screen shots and code

Screenshot 2022-02-17 112807
Screenshot 2022-02-17 112923

Screenshot 2022-02-17 113610

Which is, unfortunately for you, correct. What you have is a dropdown contrived to look like a select element but actually isn’t.

The spy tool is only a “get you going” solution. That element has obviously confused it (and you).

That being the case, you cannot use WebUI.select* on that element – they will all fail.

1 Like

Is there a solution around this

Yes, of course. But you should understand, I can’t see your AUT or your test code. There are MANY ways to approach this but I can’t chose what you need when you’ve not provided any info. Please read this and respond accordingly: [TIP] How To Help Us Help You!

here is some more code, it looks like the element is hidden

Screenshot 2022-02-17 125835

i found the hidden value, and updated on my variable, took off the select option by label and tried normal click option. I changed my attribute value and still getting an error message

anything else I can try

Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Quick Appraisal/Page_Orders Anow/Ordered by QA’ located by ‘//*[@class = ‘select__placeholder css-at6jbm-placeholder’ and (text() = ‘Search or create new client’ or . = ‘Search or create new client’) and @name = ‘ef88b778-f624-4353-b8bc-9cb858571291’]’ not found

image

@alex.tapia, Try clicking ‘Add’ button & then add a new attribute: type= hidden & change name=orderedBy. Tick only those attributes.

1 Like

You don’t need to only use the drop-down to select what “Name” you use for your attributes. You can type any attribute you need. So in your image, you have “name” equals “ef88b…” Highlight the “ef88b…” in the “Value” column and type, “orderedBy”.

Then Add a new row and type in “tag” for Name “equals” and “input” for Value.
Then Add another new row and type in “type” for Name “equals” and “hidden” for Value.

Also note that “ef88b…” is the “value” attribute, not the “name” attribute as you have, as per your image.

1 Like

I followed your steps and im still getting an error, I removed the Select option by label in my code
this is my error
Caused by: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Quick Appraisal/Page_Orders Anow/Ordered by QA’ located by '//input[@name = ‘hidden ’ and @orderedBy = ‘ef88b778-f624-4353-b8bc-9cb858571291’ and @type = ‘hidden’]’ not foundScreenshot 2022-02-18 103919

Nope. Compare above to what you have.

Why are you tying to click a hidden input?

what does that message you wrote mean?

after updating my attribute Im getting this error now
Caused by: org.openqa.selenium.ElementNotInteractableException: element not interactable
At object: ‘Object Repository/Quick Appraisal/Page_Orders Anow/Ordered by QA’
Screenshot 2022-02-18 115540

the element on the page is hidden

Obviously. That’s like saying the blue element is blue.

If you’re trying to click the element you highlighted in this image…

image

you are wasting everyone’s time – not just yours. You need to learn how these elements work. If you’ve never read this following page – all of it – then you need to do that now.

Once you’ve read and understood what a hidden input actually is, then you can come back with an explanation of what it is you’re actually trying to do. Honestly, I’ve scoured your posts and I can’t figure out what you want to achieve with this test.

Now seriously, hit rewind and give us an idea what you’re trying to achieve. Describe what the AUT does, and what you’re trying to do in the test. Provide as much detail as you can. And when you do that, stop looking at the hidden input – it is not the problem*.

> * it is not the problem -- Never try to manipulate a control that a real human user cannot manipulate themselves. If a human can't do it, don't try to do it with automation.
1 Like

thank you for that information on what a hidden input actually is.
What I want this test to do is create an order, (address, who ordered it, who is it assigned to and report type). When I create my test I use spy web and usually use the elements xpath as the selected method. This is the 1st time I’ve encountered a hidden value. I thought this element was going to be select element and not a div element. I’ve tried different ways to run the test from mouse over, delay, and even clicking on the 1st name listed on the the elements, I’ve watched youtube videos, joined a FB group as well. After all these failed attempts I reached out to the community for assistance. the reason for this test is to see if this tool can add an address. which is needed in not only when creating an order but in other areas of the software. I’M NOT TRYING TO MANIPULATE THE SYSTEM BY USING AUTOMATION I’m using this tool to help test our software.

Sorry, but you are.

Which is called automation.

Last ditch attempt at getting the point across to you …

Katalon Studio allows you to automate/simulate the actions of a user using a web-based application (AUT).

web-based: Something written in HTML/CSS/JavaScript that runs in a web browser.
AUT: Application Under Test.

Repeat: that is not the problem. The sooner you move on, the sooner we get to the bottom of the issue. No real-life human user would even know the <input type=hidden...> is even there. That being the case, nor should your Test Case.

Advice:

Prerequisites: Basic knowledge of HTML (and some CSS).

  1. Write down the steps a HUMAN takes when entering an address into your AUT.

  2. Convert those steps into Test Case code in Katalon

That’s the job.

Likely looking for the wrong thing the whole time. Should have done this first…

The assistance you’re getting right now is tempered by the paucity of information you’re supplying. You’re still not explaining the steps, like this example:

  1. Click on the button marked “Order Pizza”.
  2. Enter a person’s name in the field that pops up.
  3. Click the submit button.

Also, add anything else relevant to the problem – [TIP] How To Help Us Help You! – I gave you that link before. I hope you read it.

I hope your next post contains all the missing details – perhaps then someone will be able to help you better.

Here is a brief idea of my AUT
if user wants to create an order he
1 clicks on a quick add button or the add button,
2 enters address which is powered by google
3 selects ordered by(user selects from list of users they created)
4 selects Addressed to(user selects from list of users they created)
5. selects analyst (user selects from list of users they created)
6 selects report type (drop down list)
7. select date(not necessary)
8.select fee(not necessary)
9 add button

my goal is to see that each field is working on multiple browsers. in this test steps 3, 4 and 6 all have this div element that is not a select element, I will try again and again until I figure this issue out, by doing more research, and asking around as well.

I’m not an expert in coding but I do have a understanding of HTML, CSS, Javascript, SQL.
I will take your advice and write out my test first, along with my objective for the test. rule Why do I need to test this?

The community has helped me before, so I value there expertise, I have added code and screenshots when asking questions. I will work on this over the weekend to hopefully find a solution to my issue. Hope we talk again in the future

here is my code
WebUI.callTestCase(findTestCase(‘Staging Login’), [:], FailureHandling.STOP_ON_FAILURE)

WebUI.click(findTestObject(‘Quick Appraisal/Page_Orders Anow/quickAdd-bolt’))

WebUI.delay(5)

WebUI.setText(findTestObject(‘Quick Appraisal/Page_Orders Anow/add address Property search-QA’), ‘770 Eastern Pkwy, Brooklyn, NY 11213, USA’)

WebUI.sendKeys(findTestObject(‘Quick Appraisal/Page_Orders Anow/add address Property search-QA’), Keys.chord(Keys.ARROW_DOWN))

WebUI.sendKeys(findTestObject(‘Quick Appraisal/Page_Orders Anow/add address Property search-QA’), Keys.chord(Keys.ENTER))

WebUI.click(findTestObject(‘Quick Appraisal/Page_Orders Anow/Ordered by QA’))

WebUI.delay(3)

WebUI.sendKeys(findTestObject(‘Quick Appraisal/Page_Orders Anow/Ordered by QA’), Keys.chord(Keys.ARROW_DOWN))

WebUI.click(findTestObject(‘Quick Appraisal/Page_Orders Anow/Report Type’))

WebUI.click(findTestObject(‘Quick Appraisal/Page_Orders Anow/button_Add Property’))

my attributes
//*[@name = ‘orderedBy’ and @type = ‘hidden’]

Can I suggest a small change

Now at this point, I would right click on the page and select “Review Source”. On the source page, bring up the Find box and search for “google”. If your address search is powered by Google, then let’s look for their name on the page. If you find the google look-up input, then this may be the component you want, not the hidden one.
I like the Arrow_Down and Enter part of your code, as well. An alternative is to use clickOffset if you can’t get the click to work, like:

WebUI.clickOffset(findTestObject('Quick Appraisal/Page_Orders Anow/add address Property search-QA'), 100, 45)

is this the google look-up input information

It seems to be. Notice the “value” attribute is the same as the address you have typed in. So, try a click event on it to see if it works. Otherwise, I can only suggest the clickOffset() method.