Using waitForElementPresent without an Object

Hi,

I have a simple scenario where I click a button, which generates a textbox, and then I enter a string in the textbox. I first tried placing a WebUI.Delay() for a few second in between clicking the button and entering the string, so this would gives the system some time while the button is generated. This worked fine. But it is bad practice to use Delays so I tried the following:

WebUI.waitForElementPresent("id=ABC", 10) //ABC is the textbox's id

I received the following error:

FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementPresent() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [id=ABC, 10] Possible solutions: waitForElementPresent(com.kms.katalon.core.testobject.TestObject, int)

So I tried the following:

WebUI.waitForElementPresent(findTestObject("id=ABC"), 10)

But I received the following error:

Test object with id ‘ABC’ does not exist

I interpret this saying that I must Spy the Web for this textbox element and store it in the Object Repository. But if so, then why does Katalon’s waitForElementPresent command require the textbox element be stored as an object? Why require just games instead of just letting me directly wait for “id=ABC”?

Thanks.

2 Likes

Hi Ilya

TestObjects are a means to “wrap” the details of DOM elements and provide an interface to Katalon code. It is unfortunate that, if you want to use the majority of the Katalon framework and its WebUI APIs, you have to use TestObjects to access elements on a page. TestObjects are a “cost” you have to pay when you “buy into” the Katalon WebUI and framework. However, there are other ways…

“Spy Web”. I used the spy tool for about a day when I first started using Katalon – it’s a cumbersome UI and unwieldy UX that creates an even more cumbersome tree of objects. But you don’t even need it.

One solution is to build your own objects by hand and store them in the repository. An object needs a name and a means to access/find the real DOM element when used in a test. I use CSS but if you know xpath, you can use that instead. Make sure you understood what I just said: a name and a CSS selector – that’s all you need. By the time I’ve started the Spy tool and spun up a browser and fiddled around with the highlighter, I can create three or four objects by hand and be using them in tests. And my tree makes perfect sense to me afterwards.

If you have a large web application to test (mine has 105 pages with most containing 50 or more controls with multiple tables/grids and buttons), then you will have many hundreds (thousands?) of objects that need to be created and stored in the repository. I soon realized the object repository doesn’t scale well and is yet another bad idea.

But you don’t need that either…

build ONE object and reuse it over and over by modifying it with WebUI.modifyObjectProperty.

Fixed period delays: You’re right – they are rarely a good idea. But you do need to wait – testing code runs far quicker than a browser which needs to layout HTML, reformat for CSS and run javascript (if present). So it is much better to wait for known conditions to arise. For example, wait until an element is present (or visible) before attempting to access it in your test case.

Now to your error: findTestObject wants the path to your test object as it is stored in the object repository. So, if your text box (input type=“text”) has the name ABC in the repository, and your page is called mypage and you have your objects stored in the repository grouped by page, then:

WebUI.waitForElementPresent(findTestObject("mypage/ABC"), 30)

Personally, I would prefer to check for visibility:

WebUI.waitForElementVisible(findTestObject("mypage/ABC"), 30)

In the repository, your ABC object will need a CSS setting like so:

#ABC

or the equivalent xpath, if you prefer.

In my code base, your test step would look like this (which I think is what you were expecting to get for free from Katalon – perhaps KMS will add this capability in a future release?)

waitVisible("#ABC")

I hope this was some help?

Russ

p.s. @KMS it sounds like I am having a rant at how bad Katalon Studio is: not true. KS is the best testing solution available by a long way. Sure, it needs work and some of the tools are cumbersome but you guys are doing a great job and this community is testament to that.

7 Likes

I think the above post should be a sticky.

Fantatsic post Russ!

You write:

“Spy Web”. I used the spy tool for about a day when I first started using Katalon – it’s a cumbersome UI and unwieldy UX that creates an even more cumbersome tree of objects. But you don’t even need it.
One solution is to build your own objects by hand and store them in the repository. An object needs a name and a means to access/find the real DOM element when used in a test. I use CSS but if you know xpath, you can use that instead. Make sure you understood what I just said: a name and a CSS selector – that’s all you need. By the time I’ve started the Spy tool and spun up a browser and fiddled around with the highlighter, I can create three or four objects by hand and be using them in tests. And my tree makes perfect sense to me afterwards.

First, why does Katalon work with manipulating elements on screen by directly referencing their element’s ids, but with others it fails and you must create an object based on the element’s CSS or XPATH? And why can’t the SpyWeb just store the element’s id in the object, rather than CSS or XPATH?

Second, but the only way to to build objects is to manually find the element’s XPath or CSS in the first place in the web page is to use Spy Web or Mozilla Developer. Therefore, unless you write the website code yourself (which I don’t) you have no alternative but to use Spy Web.

You said:

Make sure you understood what I just said: a name and a CSS selector – that’s all you need.

First, can you give a precise common example that you might use?

Second, I’m also still not sure why the element’s id or name is not enough. Is this what you mean when you say “that’s just the cost of using Katalon”?

You say:

build ONE object and reuse it over and over by modifying it with WebUI.modifyObjectProperty.

Is the following a correct interpretation… Say I have a page with 12 fields, each has an XPath and I must click them. The bad way to do it is to store each of the element’s XPath as a seperate object. Rather, have one “dummy” object whose own XPath is irrelevent. Each time you click a field, change the dummy’s XPath and then immediately call it.

I followed the rest of the directions and it worked, but strangely. I should say that I am converting my former Seleneium IDE scripts to Katalon. The id of the element is 123 and its CSS is ABC. I created an object in the repository with CSS=ABC. I then wrote the following in Katalon:

WebUI.waitForElementVisible(findTestObject('Object Repository/New Test Object'), 30)
selenium.type("id=123", "Zubjects_Manager")

It worked! But now I’m confused. Should I interpret this as saying that you can use ids directly, but only when are transfered from Selenium IDE commands. But if you wish to use Java or Katalon commands, then you can only manipulate elements through their respective objects?

Now, I have dozens of tests that I wish to transfer from Selenium IDE to Katalon. Katalon looks fantastic. But this means that EVERY TIME may Selenium IDE script fails in Katalon to simply use an element’s id, I must go through the pain of manually finding its XPATH or CCS, creating an object for it (or using that single dummy object as proposed) and stick it into . And this shall happens thousands of times.

Thanks Russ! Maybe this conversation can one day be turned into a tutorial for new users.

Fantatsic post Russ!

o:)

Okay, let’s see if I can get to all of your points/questions… (deep breath)…

First, why does Katalon work with manipulating elements on screen by
directly referencing their element’s ids, …

Depends what you mean: Katalon supports a Java based coding environment. That means, you can use pretty much ANY Java packages you like in your code – some of which may let you access html elements directly via their native IDs, but I don’t know of any. However, that’s not what normally happens. Normally, (in KS) you use TestObjects – those things you store in the Object Repository (OR); those things that “wrap” html elements and interface to your Groovy code. So, I’m only talking about “normally”. Clear? Good.

So, normally, I don’t know that KS Groovy code ever deals with IDs directly – it uses TestObjects, period. You’ll need to tell me where you think KS is doing that. Maybe I missed something, somewhere. Happens :wink:

…but with others it fails and
you must create an object based on the element’s CSS or XPATH? And why can’t the SpyWeb just store the element’s id in the object, rather than CSS or XPATH?

Not every element has an ID. It’s super nice when they do, but as you’re likely aware, they very often don’t. So, if IDs are not always available, how then are you (and your testing code) meant to identify which elements are meant to be tested? Answer: CSS or xpath. Take a look at this example: imagine you need to “reach” the third

  • element here:

    <ul id="my-list">
      <li>Item one</li>
      <li>Item 2</li>
      <li>Item the third</li>
      <li>This list is too long already</li>
    </ul>
    

    So the

      element has an ID but the third
    • (the thing we’re interested in) does not. Here’s how you reach it in CSS:

      #my-list li:nth-child(3)
      

      Which is best interpreted “backwards”: it’s the third child element with tag “li” which itself is a descendant of something with an ID “my-list” (“#” means “ID”).

      For testers that are not familiar with the underlying HTML (because they didn’t code it, for example) then a number of different strategies can be used to try to “fine-tune” the targeting of the element: CSS, xpath, text, name, star sign, favorite pop star, etc. :slight_smile: So that’s why TestObjects (in the OR) have all those different “methods”. But, like I said before, if you know what you’re doing and you know what KS is trying to do and you can figure out either CSS or xpath, you don’t need them ALL. See?

      One sure-fire way is plenty good enough, ALL of the time.

      For me, personally, Spy is doing way, way too much and creates a jungle full of references in the OR.

      but the only way to to build objects is to manually find the element’s
      XPath or CSS in the first place in the web page is to use Spy Web or
      Mozilla Developer. Therefore, unless you write the website code yourself
      (which I don’t) you have no alternative but to use Spy Web.

      I do help code my AUT and I regularly hit F12 or right-click choose “Inspect” to remind myself the structure of my app and the thing I’m trying to target for testing. I do, of course, have the advantage of being a “CSS guy”, but still, my theory that “Spy and the OR” get in the way (they hinder rather than help) are born out by your question(s) to this forum. Let me say that another way: if you use Spy, you need the OR. If you use the OR, you need Spy. See the problem? And when you do that a lot with a large application? Well, good luck. You’ll need it.

      Is the following a correct interpretation… Say I have a page with 12
      fields, each has an XPath and I must click them. The bad way to do it is
      to store each of the element’s XPath as a seperate object. Rather, have
      one “dummy” object whose own XPath is irrelevent. Each time you click a
      field, change the dummy’s XPath and then immediately call it.

      Bang on. (You know what’s really spooky? “dummy” is EXACTLY the name I use! :wink:

      Now, couple of points. “The bad way”, as you put it, is not really bad, it just doesn’t scale well. You (we) have enough to do without maintaining an ever growing list of TOs in the OR. Bring Spy into the picture and all hell breaks loose. And as another person posted earlier, TOs/ORs don’t move between projects (yet - perhaps KMS will address that at some point). I’m slowly removing mine in favor of dummy and “memory TOs” (TOs created in memory “live” as you need them. See: Can i Parameterizeda only part of Test Object id? - #2 by Marek_Melocik - Archive - Katalon Community)

      And, of course, I use CSS, not xpath – either is fine though.

      I followed the rest of the directions and it worked, but strangely. I
      should say that I am converting my former Seleneium IDE scripts to
      Katalon. The id of the element is 123 and its CSS is ABC. I created an
      object in the repository with CSS=ABC.

      I didn’t understand the code that followed this quote… and I don’t understand what you mean by “its CSS is ABC” and its id is 123. So let’s be clear, look at this HTML:

      <div id="abc"> ... </div>
      

      This HTML DIV element has an ID set to “abc”. If you were to use that ID in CSS then you need to prefix a “#”, like this:

      #abc
      

      If you want to be EXTRA specific, you can prefix “div” to that as well:

      div#abc
      

      Since IDs are meant to be unique* throughout a document the “div” is unnecessary.

      * It’s ILLEGAL to create two or more elements with the same ID. If you do,
      the CSS Police will hunt you down, kill baby kittens and throw them at
      you. True. No, really.

      So, in your OR you can create an object called “whatever” and give it a CSS Selection Method:

      #abc
      

      Now, I have dozens of tests that I wish to transfer from Selenium IDE to
      Katalon. Katalon looks fantastic. But this means that EVERY TIME may
      Selenium IDE script fails in Katalon to simply use an element’s id, I
      must go through the pain of manually finding its XPATH or CCS, creating
      an object for it (or using that single dummy object as proposed) and
      stick it into . And this shall happens thousands of times.

      I’m not the best person to advise on bulk conversion of Se scripts but I hear you. But listen, “one step at a time… it isn’t a race…”.

      Let me know if there’s anything I missed above.

      Russ

  • Hi Ilya,

    There was one more thing I was going to say – it’s the answer to a question you didn’t quite ask, so here’s the question (as if you’d asked it), followed by the answer:

    Is it possible to access a web page element without resorting to TestObjects?

    Yes. You can use regular DOM APIs and JavaScript in your KS Groovy code. My application uses jQuery so I use that. Here’s my jQuery version of waitForElementVisible:

      /**
       * Makes multiple attempts to verify element identified by <code>selector</code> is visible.
       * @param selector (String) CSS selector to be checked.
       * @param iFrameSelector (string) optional iframe selector.
       * @return true if item is visible, else false.
       */
      static boolean jQ_waitVisible(String selector, int timeoutSeconds, String iFrameSelector = null) {
        boolean viz = false
        String js = "return \$(arguments[0]).is(':visible');"
        if(iFrameSelector) {
          js = "return \$(arguments[1]).contents().find(arguments[0]).is(':visible');"
        }
        comment('jQ_waitVisible checking visibility: ' + selector)
        int count = 0;
        while (!viz) {
          count++
          if(count > timeoutSeconds) {
            markFailed('jQ_waitVisible failed for ' + selector + ' (timeout).')
            return
          }
          viz = (boolean) jsexec(js, Arrays.asList(selector, iFrameSelector))
          if(viz) {
           break
          }
          WebUI.delay(1)
        }
        markPassed('Success: ' + selector + ' is visible!')
        return viz
      }
    
      /**
       * Execute JavaScript.
       * @param jsString (String) The JavaScript code to be executed.
       * @param args (List) Arguments to be passed to JavaScript.
       * @return The result returned from JavaScript.
       */
      static Object jsexec(String jsString, List<Object> args) {
        return WebUI.executeJavaScript(jsString, args)
      }
      
    
    
    

    And I call it (using the “abc” example from earlier) like this:

    jQ_waitVisible("#abc")
    

    Note: if you don’t have jQuery running then you’ll need to convert that code to use document.querySelector. For example:

    jsexec("return document.querySelector(arguments[0])", Arrays.asList(selector))
    

    Russ

    You said the following about IDs

    That means, you can use pretty much ANY Java packages you like in your code – some of which may let you access html elements directly via their native IDs, but I don’t know of any.

    In retrospect, I see you were correct all along. I checked my code again and I now see that it is ONLY the automatically imported Selenium IDE commands that work with simple Ids. For example, I have some textbox with id=ABC. Katalon converted it into the following:

    “type | id=ABC | Test Role”
    selenium.type(“id=ABC”, “Test Role”)

    This works fine. But of course it is not a standard Java or WebUI commands of which you have spoken.

    My LAST (I promise) question. Let’s say your team adds a section to your company’s product website with 5 new pages with a total of 100 new fields. Each such field has a unique CSS/XPATH. Assume you did not participate in writing the new code. YOU must now write auto-tests of these five pages and 100 fields. You must now find and record 100 different CSS/XPATH strings!!! I have been using the simple record and Play feature of Selenium IDE which “magically” does this all for me. But you have already told me you do not take the “easy” route by simply creating the tests with Katalon’s Record & Play and SpyWeb features because both automatically use the inefficient monstrosity of the Object Repository. Can you describe for me the mechanical process by which a Pro like you goes through the pain of manually detecting each of the 100 individual field’s CSS/XPATH? My mental picture of you is opening Firepath/Firebug in Mozilla Firefax, scouring the page for each individual CSS/XPATH, copying and pasting each one into a simple .txt file which eventually has 100 lines, and then copying and pasting the CSS/XPATHs from the .txt file to Katalon as needed.

    Once again, thanks Russ.

    “type | id=ABC | Test Role”
    selenium.type(“id=ABC”, “Test Role”)

    This works fine. But of course it is not a standard Java or WebUI commands of which you have spoken.

    Right. And since my selenium experience is limited (to a few brief months 2 million years ago when Se first came out and now, recently, playing with Katalon Recorder as a “refresher”) that’s the kind of thing I meant by I’m not the best person to advise, perhaps. That said, …

    If it works for you, great.

    Let’s say your team adds a section to your company’s product website
    with 5 new pages with a total of 100 new fields. Each such field has a
    unique CSS/XPATH. Assume you did not participate in writing the new
    code. YOU must now write auto-tests of these five pages and 100
    fields. You must now find and record 100 different CSS/XPATH strings!!!

    Right. One way or another, “something” (someone) needs to tell the system (webdriver) what to click on, what to examine, what to hover over, etc. Broadly speaking, you have two choices:

    1 - The “easy” route, using a tool like “Spy Web” (and live with the mountain of TestObjects in the Object Repository)

    2 - The “by-hand” route and not have a maintenance headache managing the OR.

    The thing I like best about #2 is this: when I search for items in my test code, the detail is right there staring me in the face -- it’s not buried in another place (the OR) which I need to move to, browse, find the damn thing and open it, then realize I opened the wrong thing because two (or more) things right next to each other are similarly named or because Spy Web created multiple “page” objects with multiple test objects almost (or completely) identical… and and and…

    Get the picture?

    Sorry. I don’t have time for that. Analogy: there’s a reason you don’t keep individual socks in individual sock drawers. That would be crazy, right?

    My mental picture of you is opening Firepath/Firebug in Mozilla Firefax,
    scouring the page for each individual CSS/XPATH, copying and pasting
    each one into a simple .txt file which eventually has 100 lines, and
    then copying and pasting the CSS/XPATHs from the .txt file to Katalon as
    needed.

    Mozilla Firefax :wink: That’s great :wink:

    Well, that’s close but let me detail it for you:

    First, I have a copy of Firefox Nightly running on my desktop, open to the page I’m currently running tests against. No Firepath/Firebug, I use the native FF devtools (hit F12 to see them).

    Here’s my method:

    1 - In FF, right-click on the element of interest (a text box for example).
    - The context menu appears.

    2 - Click on “Inspect Element”

    • the devtools inspector opens and highlights the item of interest. If not, it’s pretty close.
      - I always have my devtools separated from the main browser window (on a separate monitor). But that’s just me…

    3 - If the item has an ID, I double-click the ID value, (puts you in edit mode) and hit Ctrl-C (copy)

    Now I have the thing I want I can use it in my test in KS.

    Obviously, sometimes I need to figure out a bit more CSS than just an ID, especially if the element doesn’t have an ID but that’s beyond the scope of this writeup… you just gotta learn it :wink:

    What you could do is use the Spy tool to let it figure out the CSS/xpath for you, then copy that into your code and delete the Test Object from the OR (since, as we’ve agreed, we don’t need it). Plus, doing it that way, you’ll get to learn how you can yourself construct better CSS/xpath as you go… make sense?

    Okay… I hope that helped.

    And by the way, don’t think of it as “hundreds of CSS strings” you need to copy/paste. The aim here is that every single test (and test step) you write should be robust and rock-solid. When things “go wrong” (and they will!) you only have one place to look. Plus, without TOs to worry about, copying/renaming TestCase code between projects becomes very easy. Almost too easy.

    Let me know if any of that wasn’t clear.

    Russ

    p.s. Today, I’ve almost reduced my OR to nothing. :slight_smile:

    1 Like

    Thanks Russ!

    @Russ Thomas

    How exactly can you change the CSS to your element using WebUI.modifyObjectProperty? What is the exact propertyName?
    I tried something like this:

    WebUI.modifyObjectProperty(findTestObject("DUMMY"), 'CSS', null, 'input[placeholder="abc"]', false)
    WebUI.doubleClick(findTestObject("DUMMY"))
    

    but I get the following message:

    Cannot find property with name 'css' in test object 'Object Repository/DUMMY'. Creating new property with name 'css'
    

    Hi Mate

    I think the property name needs to be lower case, so try…

    WebUI.modifyObjectProperty(findTestObject("DUMMY"), 'css', 'equals' ...
    

    I used to use this but deprecated it in favor of an in-memory TO instead:

    /**
      * Modify a property (css, xpath, etc) of a TestObject to create a clone TestObject.
      * @param property (String) The name of the property to change.
      * @param value (String) The new value to apply to the property.
      * @param objectId (String) The id of the object to be modified (cloned).
      * @return (TestObject) The modified (cloned) TestObject. 
    */
      static TestObject setTestObjectProperty(String property, String value, String objectId) {
        objectId = objectId ?: "dummy"
        return WebUI.modifyObjectProperty(findTestObject(objectId), 
          property, "equals", value, true)
      }
    

    Hi @Russ Thomas,

    I’m new to Automation and Katalon Studio. I want to try and use what you talk about above about not using the OR, but not quite sure how to start. Can you provide a more complete example, maybe post a sample Katalon project on Github.

    Thanks,
    Jon

    Hi Jon

    Perhaps, maybe, one day :wink:

    I seriously don’t have the time right now and can’t see far enough ahead to say when that might change.

    Sorry.

    No worries, I appreciate the quick response.

    Thank you, Russ, but it seems my code still isn’t working. Here’s the relevant part:

    WebUI.modifyObjectProperty(findTestObject("DUMMY"), 'css', 'equals', 'input[placeholder="Base"]', true)
    WebUI.doubleClick(findTestObject("DUMMY"))
    CustomKeywords.'metode.webElementi.popuniComboBox'(findTestObject("DUMMY"), findTestData("R-TABLE(1)").getValue(1, 10), 5)
    

    The log says the ‘dummy’ object has been found and the property has been successfully modified:

    04-04-2018 09:05:02 AM - [START]  - Start action : modifyObjectProperty
    04-04-2018 09:05:02 AM - [INFO]   - Finding Test Object with id 'Object Repository/DUMMY'
    04-04-2018 09:05:02 AM - [INFO]   - Check Test Object
    04-04-2018 09:05:02 AM - [INFO]   - Check property name
    04-04-2018 09:05:02 AM - [INFO]   - Check modify value
    04-04-2018 09:05:02 AM - [INFO]   - Check match condition
    04-04-2018 09:05:02 AM - [PASSED] - Modify property of object successfully
    04-04-2018 09:05:02 AM - [END]    - End action : modifyObjectProperty
    

    But when it continues, Katalon tries to doubleclick the original css path (before modification) and finds 6 elements (not the ones I targeted):

    04-04-2018 09:05:02 AM - [START]  - Start action : doubleClick
    04-04-2018 09:05:02 AM - [INFO]   - Finding Test Object with id 'Object Repository/DUMMY'
    04-04-2018 09:05:02 AM - [INFO]   - Checking object
    04-04-2018 09:05:02 AM - [INFO]   - Checking timeout
    04-04-2018 09:05:02 AM - [INFO]   - Finding web element with id: 'Object Repository/DUMMY' located by 'By.cssSelector: div.c-header-close' in '30' second(s)
    04-04-2018 09:05:02 AM - [INFO]   - Found 6 web elements with id: 'Object Repository/DUMMY' located by 'By.cssSelector: div.c-header-close' in '30' second(s)
    04-04-2018 09:05:02 AM - [INFO]   - Double clicking on object: 'Object Repository/DUMMY'
    04-04-2018 09:05:02 AM - [PASSED] - Object: 'Object Repository/DUMMY' is double clicked on
    04-04-2018 09:05:02 AM - [END]    - End action : doubleClick
    

    So, the test fails because the custom keyword sends text to wrong elements and I get this exception:

    04-04-2018 09:05:02 AM - [START]  - Start action : metode.webElementi.popuniComboBox
    04-04-2018 09:05:02 AM - [INFO]   - Finding web element with id: 'Object Repository/DUMMY' located by 'By.cssSelector: div.c-header-close' in '30' second(s)
    04-04-2018 09:05:02 AM - [INFO]   - Found 6 web elements with id: 'Object Repository/DUMMY' located by 'By.cssSelector: div.c-header-close' in '30' second(s)
    04-04-2018 09:05:02 AM - [INFO]   - Clearing text of object 'Object Repository/DUMMY'
    04-04-2018 09:05:03 AM - [FAILED] - Unable to set text 'some text' of object 'Object Repository/DUMMY' (Root cause: org.openqa.selenium.InvalidElementStateException: invalid element state: Element must be user-editable in order to clear it.
    

    Am I doing something wrong or is this a Katalon bug?

    I’m having the same issue. Can’t seem to get this to work, no matter what I try.

    Guys, it would help a lot if you showed your code (along with the errors reported in the log viewer).

    So, as a guess, I’d say your code is modifying the object you retrieved from the OR, then your code uses the object from the OR.

    Right?

    Problem: **that is not the object you modified.

    **The manual states the following:

    [WebUI] Modify Object Property

    This keyword does not modify the object
    saved in Object Repository
    , instead, it creates another test object,
    modifies and returns this test object. Hence, users must use a variable
    to store the returned object
    .

    So, in brief,

    def myModifiedObject = WebUI.modifyObjectProperty(...)
    WebUI.doSomething(modifiedObject)
    
    

    Let me know how it goes…

    Russ

    1 Like

    *facepalm*
    You are right, that was the problem! I just stored my WebUI.modifyObjectProperty resutlt in a variable and it works perfectly. Thank you!

    Great post! :o

    2018/06/15
    Inspired by the discussion here, I made another post “Parameterized Test Object on the fly”. See

    1 Like

    Hi

    I tried each and every option listed here. My test object is still not being recognize.
    Maybe i am repeating the same question. But obviously it did not resolve the problem.

    The scenario is very simple. Click on the email arrived.

    So here are various solutions suggested.

    1. Created my own test object and called it Email1.

    Xpath: id(“:38”)/span[@class=“bA4”]/span[@class=“yP”]’ not found)

    I get this error:
    Unable to click on object ‘Object Repository/Page_Inbox (479) - andrewkhomskigma/Email1’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_Inbox (479) - andrewkhomskigma/Email1’ located by ‘By.xpath: id(“:38”)/span[@class=“bA4”]/span[@class=“yP”]’ not found)

    Error occurs at this 2 lines:

    WebUI.waitForElementPresent(findTestObject(‘Page_Inbox (479) - andrewkhomskigma/Email1’), 10)

    WebUI.click(findTestObject(‘Page_Inbox (479) - andrewkhomskigma/Email1’))

    2. Used test object recorded and added to Object Repository.

    I get this error:
    Unable to click on object ‘Object Repository/Page_Inbox (479) - andrewkhomskigma/span_AH 10062018 1137’ (Root cause: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/Page_Inbox (479) - andrewkhomskigma/span_AH 10062018 1137’ located by ‘By.xpath: id(“:38”)/span[@class=“bA4”]/span[@class=“yP”][count(. | //span[@class = ‘yP’ and @name = ‘AH 10/06/2018 11:37’ and @data-hovercard-owner-id = ‘28’ and (text() = ‘AH 10/06/2018 11:37’ or . = ‘AH 10/06/2018 11:37’)]) = count(//span[@class = ‘yP’ and @name = ‘AH 10/06/2018 11:37’ and @data-hovercard-owner-id = ‘28’ and (text() = ‘AH 10/06/2018 11:37’ or . = ‘AH 10/06/2018 11:37’)])]’ not found)

    Error occurs at this 2 lines:

    WebUI.waitForElementPresent(findTestObject(‘Page_Inbox (479) - andrewkhomskigma/span_AH 10062018 1137’), 10)

    //WebUI.click(findTestObject(‘Page_Inbox (479) - andrewkhomskigma/span_AH 10062018 1137’))

    Appreciate any advise - i am not sure what else left here or what i missed…

    Thank you!
    Andrew

    Option1.png

    Option2A.png