Test Case Fails after successful first run. Can't find Element (search bar) to continue to next web page

Hi All,

Full caveat, I’m not a techie at all. Just a pencil pusher trying to automate some of the easier stuff. I can’t use Studio, only recorder. (459.4 KB) Please let me know if I can describe anything further or add more detail.

I’m trying to create a test case that 1. Opens a webpage 2. Clicks on a search bar and enters in a project number. 3. Click on a link which opens a new webpage. 4. Enter data from CSV into a few separate boxes on that new web page. 5. Click on “Next” (Which saves info). 6. Restart the process with the next project number from CSV data.

The first test case run works perfectly, however when it’s time to load the second project, it get’s stuck at Step 2, claiming it cannot find the search box anymore, even though it finds it no problem on the first run. I am thinking it’s related to the fact that a new window pops up after step 3? I’ve tried adding “Selectwindow Null” after step 1. just so it re-selects the “main” page, but that didn’t seem to help. Error message and log data below.

[error] Cannot find element

[error] Element css=#TXT_Search not found


Help Test Case won’t do multiples.html

Going to copy XPath from each element that’s clicked in their respective order in case that helps provide opposite solution.

//*[@id=“TXT_Search”]

//*[@id=“imgExternalLinks”]

//*[@id=“195”]/ul/li[16]/a

//*[@id=“pt1:s1:it3::content”]

//*[@id=“pt1:s1:it1::content”]

//*[@id=“pt1:s1:it2::content”]

//*[@id=“pt1:bottom-buttons:cbNext”]/span

maybe yes, maybe not. You yourself should be able to tell it.

Your target URL https://atc.siterra.com/login/default/ is publicly accessible on the Internet, but is password protected. So I can not get access to it easily. I can not see how the site works, how the HTML of pages looks like.

I can not understand this description without the target web site is in action on browser on my PC.

After every page navigation by open command or click command, you should make sure that the page has been completely loaded, and the loaded page is exactly what you expected. Page loading may take a few seconds. So your test script must wait long enough before the page is loaded. Your code should be defensive enough. Every single open and click should be followed by a waitFor*.

Do you know waitFor* command? for example, Using waitForElementPresent command, you can wait for t the HTML is loaded completely.

I would recoomend this article to understand why you should know “waitFor*”

Thank you Kazurayam. I have reviewed the “WaitFor” example and by utilizing pause command & waitfor/ClickAndWait, I’m running into fewer errors of missing element.

The Recorder still struggles with selecting the new webpage that opens, but I don’t think I’m able to share enough info for help with that issue.

Has anyone found a fix for this [error] Cannot find element ?

[info] Executing: | selectFrame | index=10 | |

[info] Expand variable ‘index=10’ into ‘index=10’

[info] Executing: | type | id=file-upload | /Users/gc/Downloads/1.png |

[info] Wait until the element is found

[info] Cannot find element id=file-upload after 1000ms switch to id=file-upload

[info] Executing: | type | id=file-upload | /Users/gc/Downloads/1.png |

[info] Wait until the element is found

[info] Cannot find element id=file-upload after 1000ms switch to id=file-upload

[info] Executing: | type | id=file-upload | /Users/gc/Downloads/1.png |

[info] Wait until the element is found

[error] Cannot find element

[error] Element id=file-upload not found

Just to ask, have you verified that the selector still works? Usually, this issue only happens when the XPath / selector used (which may have worked before even) no longer works.

There’s nothing syntactically or apparently wrong with your command, if the selector is still the relevant one. But, FWIW, you may want to try changing it from id=file-upload to id=‘file-upload’