Javascript post with Selenium (RC)

In my application, a lot of calculations are done in JavaScript, depending on how and when the user acts in the application. The project prints out valuable information (via console calls) about how this calculation happens, and therefore we can easily determine any mileage NaN.

We plan to integrate Selenium (RC with python) for testing or a project, but if we could get console output in a python test case, we can identify any NaNor even any miscalculations.

So, is there a way Selenium can absorb these outputs (preferably in an environment without a console)?

If not, I would like to know if I can redirect the console calls, maybe by binding the variable consoleto something else so that selenium can get this output and notify the python side. Or, if not the console, is there any other way I can achieve this.

I know selenium has commands like waitForElementPresent, etc., but I don’t want to show these intermediate calculations in the application, or is this the only way?

Any help was appreciated.

Thanks.

+3
source share
2 answers

There is a call to GetEval () that returns the result of a JavaScript call to the page. If you have javascript on the page, you can do something like

self.assertEqual(selenium.GetEval("this.browserbot.getUserWindow().functionUnderTest().isNaN();"),"false","There was a NaN detected")

javascript . IsNaN() false,

+4

, JavaScript , JavaScript JavaScript . Selenium - . , , , JavaScript.

jsUnit YUI Test, . 150 FireFox, IE . - JavaScript, Selenium. UI YUI .

+1

Source: https://habr.com/ru/post/1724286/


All Articles