Reading JavaScript variables using Selenium WebDriver

后端 未结 3 1128
小鲜肉
小鲜肉 2020-11-29 23:42

I\'m using Selenium WebDriver (Java) and TestNG to do some testing on a website I created. In this website, I also have JavaScript and in some of the functions, it returns v

3条回答
  •  误落风尘
    2020-11-30 00:05

    In Ruby you can use page.execute_script to evaluate a JavaScript variable (if it is accessable from the scope of the web browser). It looks like there is a similar method in Java here.

    Edit: This might be a use case that is more suited to a JavaScript unit testing framework such as Jasmine.

提交回复
热议问题