73rhodes / sideflow

Flow control extension for Selenium IDE
MIT License
136 stars 209 forks source link

Odd failure on gotoIf #4

Closed HabaneroSalsa closed 11 years ago

HabaneroSalsa commented 12 years ago

Running Selenium IDE 1.7.2 on Firefox 10.0.0.2

I downloaded Sideflow and all the other components for DataDriven at the end of December 2011, and it does not appear that any updates have occurred since then.

My gotoIf statement was behaving unreliably in just one script.

The record previous to the one that fails is: |gotoIf | 1,008.00 < 1 | MyTargetLabel | All precious records were less than 1000.00 (first and lowest record had 82.91)

The subsequent record runs: |gotoIf | 1,071.00 < 1 | MyTargetLabel |

which causes the following error: [error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/QA/Selenium/SideFlow/sideflow.js?1339697696344, lineNumber -> 82

My script is storing the value in a variable, but when debugging I found that the literal value also causes the error so this might be a simple and portable case to reproduce. I've worked around the issue using the following approach:

|storeEval | "${MySourceVar}".replace(",", "") | MyNewVar | |gotoIf | ${MyNewVar} < 1 | MyTargetLabel |

Even though I'm no longer stuck, it would be nice to be able to accomplish this without the extra step of removing the comma.

Thank you for an excellent addition for Selenium IDE!

darrenderidder commented 12 years ago

Thanks for the info. I'll have a look at this within the next couple of weeks. Glad that you have a temporary work around.

darrenderidder commented 12 years ago

I've updated the Sideflow plugin; removed the new additions that caused your error and added a new 'push' command instead.

HabaneroSalsa commented 12 years ago

Thank you Darren, I'll try to test the changes this week!

darrenderidder commented 11 years ago

Closing as fixed

HabaneroSalsa commented 11 years ago

Hi Darren,

I tried replacing my sideflow.js file to validate the change. However, when Selenium IDE initializes, I get an error:

Failed to load user-extensions.js! files=C:\QA\Selenium\SideFlow\sideflow.js, C:\QA\Selenium\includeCommand4IDE_1_1\user-extensions.js, C:\QA\Selenium\datadriven_v0.2\datadriven.js, lineNumber=78 error=[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsILocalFile.initWithPath]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://selenium-ide/content/file-utils.js :: :: line 78" data: no]

Would you have any clue as to what was wrong?

HabaneroSalsa commented 11 years ago

It looks like the trailing comma upset the initialization, once I removed it I was able to start Selenium IDE and have access to the sideflow commands.

However, when I execute the following steps:

gotoIf 1,071.00 MyTargetLabel label MyTargetLabel

I get an error on another line:

[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/QA/Selenium/SideFlow/sideflow.js?1344979357016, lineNumber -> 95

darrenderidder commented 11 years ago

Did u load it as a core extension?

retswerb commented 11 years ago

I'm having the same issue here. I'm a programming noob, but I'm following others' examples as best as possible and haven't found any other options to work around this. Maybe I'm just doing something totally wrong?

I'm trying to check for presence of a link, then skip over some following items if the link is present. The Selenium script reads as follows:

storeElementPresent link=planning planningPresent gotoIf planningPresent TestPlanning

foo

label TestPlanning

But when I execute this, I get an error stating:

[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///C:/Selenium/Selenium%20scripts/sideflow.js?1349040244265, lineNumber -> 95

I double checked, and Sideflow is loaded as a core extension.

Any help you can offer would be great!

Edited to add: Also, what is the syntax I would use so that it would go to the label only if the condition had not been met -- i.e., if it didn't find the link in question? Thank you!

retswerb commented 11 years ago

On further review, it looks like this install is not working at all. I tried installing everything from scratch on another machine and it's not working there either. Is sideflow incompatible with Selenium IDE 1.9?

EDIT: Sorry, I was wrong there. I thought that nothing was working since I couldn't get the test file to run either -- but then I realized that the first gotolabel in that file needed to be gotoLabel and with that change I got the test file to run. Still getting the above error when I try to run my own script though.

retswerb commented 11 years ago

Ok, here's my kludge (as suggested here: http://old.nabble.com/Re%3A-while-loop-with-boolean-p12942879.html). I have a feeling that this whole thing comes from my programming inexperience, but I'm not sure where to start on my own and I've had a hard time finding resources with actual code I could copy and modify.

Ugly, but it seems to work:

store true true storeElementPresent link=planning planningPresent gotoIf ${true} == ${planningPresent} TestPlanning

foo

label TestPlanning

bar

Edited (theme of my day, apparently) to remove extra code that was waaaay uglier than it needed to be due to my own stupidity.

HabaneroSalsa commented 11 years ago

Darren,

In response to your inquiry about loading it as a core extension, yes - I always have loaded sideflow as a core extension. Sorry for the delay I was in the midst of a cross-country move at the time!