Support > Forums > OpenBots Studio > Problem stopping loop

Problem stopping loop

Stephen Healy

  • Reporter
  • Calender Icon May 06,2021 at 10:30 AM

Hi everyone,

I am using openbots to call up a list of items for invoicing. So far this is working quite well.

However, when the list has been processed, I would like to stop the bot and close the browser. So far, I have tried to use an if loop. If it cannot read the number of items in the list (this is displayed at the top of the list if there are items for processing), the bot should skip the remaining steps and close the browser.

I have used both the "If error did not occur" (in reading the number of items) and "If web element exists" conditions as an introduction to the further steps but they don't seem to work. I am using Firefox as a browser, and the "If web element exists" condition is actually throwing the error "Unable to cast object of type 'OpenQA.Selenium.Firefox.FirefoxDriver' to type 'OpenQA.Selenium.Chrome.ChromeDriver'" - what does this have to do with Chrome?

If anyone has any ideas how I can sucessfully stop the loop, I would be very grateful.

Many thanks in advance and best regards, Stephen

This forum has 314 topics, 681 replies, and was last updated 14 days ago by Support Agent

Nataly Alvarado...

  • Participant
  • Calender Icon May 11,2021 at 6:21 PM

Hello Stephen,

Unfortunately, the "If web element exists" command only support Chrome as the browser engine. In fact, Chrome offers the best interaction with OB Studio. There are alternative methods to checking an element. For example, you can use the Element Action command and set the action to Element Exists. This will save the outcome to a boolean variable, which can later be used as a condition for your Begin Loop - Variable Compare command. Alternatively, you can use the Surface Automation command (listed under the Image Commands) to check if a particular image exists and use it as a stopping condition.

You are not authorized to reply, please click here to login and add your reply to this topic.