saucepleez / taskt

taskt (pronounced 'tasked' and formely sharpRPA) is free and open-source robotic process automation (rpa) built in C# powered by the .NET Framework
http://www.taskt.net/
1.09k stars 351 forks source link

If Web Element Exists error #166

Closed AlanGould closed 4 years ago

AlanGould commented 4 years ago

Hi, great job with taskt!

I am running into an error with executing a "Begin If" command:


2019-11-26 19:04:47.256 +10:00 [INF] Running Line 19: Navigate to URL [URL: '_url removed_', Instance Name: 'instance_name']
2019-11-26 19:04:50.177 +10:00 [INF] Skipping Line 20: // Comment: Check for Bill Overview
2019-11-26 19:04:50.212 +10:00 [INF] Running Line 21: If Web Element Exists [Find Element By XPath: //div[contains(@class, '.selected_item')]]
2019-11-26 19:04:50.215 +10:00 [INF] Result Code: Error
2019-11-26 19:04:50.215 +10:00 [INF] Error: System.Exception: App Instance 'default' not found!
   at taskt.Core.Automation.Engine.AutomationEngineInstance.ExecuteCommand(ScriptAction command)
   at taskt.Core.Automation.Engine.AutomationEngineInstance.ExecuteScript(String data, Boolean dataIsFile)

Also, I did find a previous issue regarding "If Web Element Exists" - initially I was using a variable ("instance_name" set to "[DateTime.Now]") for the Selenium Instance Name, so I tried removing the variable and just using the plain string, but the error still occurs.

AlanGould commented 4 years ago

Update - I just reverted to naming the Instance Name "default" given the "If Web Element Exists" seemed to ignore the specified Instance Name. Here's a log snippet:

Create Chrome Browser - [Instance Name: 'default', Instance Tracking: Keep Instance Alive]

The outcome was that the "If Web Element Exists" worked as expected, without error. Thus, the issue is with the "If Web Element Exists" incorrectly referencing the "Selenium Instance Name" in the Additional Parameters.

saucepleez commented 4 years ago

@AlanGould Thanks for reporting this. I have confirmed the behavior described -- custom instance names are not handled properly specifically by the If Command.

saucepleez commented 4 years ago

The fix will be reflected in the next pull request and release.