selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

assertEval command is not present in new selenium IDE .Is there any update in store eval and assert eval methods in new selenium IDE

Open manikumary opened this issue 7 years ago • 4 comments

🚀 Feature Proposal

In old selenium IDE we have assert eval .The details about it are : assertEval(script, pattern) Generated from getEval(script) Arguments:

    script - the JavaScript snippet to run

Returns:
    the results of evaluating the snippet

Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned.

Note that, by default, the snippet will run in the context of the "selenium" object itself, so this will refer to the Selenium object. Use window to refer to the window of your application, e.g. window.document.getElementById('foo')

If you need to use a locator to refer to a single element in your application page, you can use this.browserbot.findElement("id=foo") where "id=foo" is your locator.

Example

command :assertEval Target this.browserbot.findElement("id=DisconnectTime").value.length != 0 value : true

It helps to verify the fields are not empty as they are mandatory in one of my use case of test.

Is there any update on this and those risk factors as mentioned earlier is solved ? Is there any other ways we can achieve this case ? Please help me on this.

manikumary avatar Feb 26 '19 11:02 manikumary

The way we encourage on using is the combination of assert and execute script:
execute script | return (document.findElementById("DisconnectTime").value.length != 0) | val assert | val | true

corevo avatar Feb 26 '19 12:02 corevo

Hi , thanks for all your click replies for all the questions. This shows this error in log

executeScript on return (document.findElementById("DisconnectTime").value.length != 0) with value val Failed: document.findElementById is not a function

manikumary avatar Feb 26 '19 13:02 manikumary

getElementById sorry, writing code out of my head.
Anyway the better place to ask these questions is the irc channel.

corevo avatar Feb 26 '19 13:02 corevo

ok thank you

manikumary avatar Feb 27 '19 05:02 manikumary