简体   繁体   English

为什么我们需要javadriver executor作为webdriver?

[英]Why we need javaScript executor for webdriver?

Can one please help me to know why we exactly need JavaScriptExecutor for Webdriver? 可以帮助我知道为什么我们对于Webdriver确实需要JavaScriptExecutor吗?

I have seen few examples using JavascriptExecutor to mouse hover, to click on any elements which can also be done normally with Webdriver. 我看到了几个使用JavascriptExecutor鼠标悬停来单击任何元素的示例,这些元素也可以使用Webdriver正常完成。

And there are cases which i have seen is when the element is disabled, using JavascriptExecutor clicking on that element. 在某些情况下,使用JavascriptExecutor单击该元素可以禁用该元素。 Why we need to perform any operations on disabled elements (to user on FrontEnd). 为什么我们需要对禁用的元素执行任何操作(前端用户)。

It is actually a nice question. 这实际上是一个很好的问题。

Selenium is basically solve simple java script event problem. Selenium基本上是解决简单的Java脚本事件的问题。

But when we need to test application at Industry level, We require to write JQuery as well as Java script. 但是,当我们需要在行业级别测试应用程序时,我们需要编写JQuery和Java脚本。

For EG In some website there is some restriction like double click or right click or selection. 对于EG在某些网站上有一些限制,例如双击或右键单击或选择。

In this cases we have to write java script with "JavascriptExecutor". 在这种情况下,我们必须使用“ JavascriptExecutor”编写Java脚本。

As per my understanding you want to ask why "JavascriptExecutor" is perform event on disable element? 根据我的理解,您想问为什么“ JavascriptExecutor”在disable元素上执行事件?

In answer , I want to say it is may be a test case requirement. 答案是,我想说这可能是一个测试用例的要求。

You may be think why we need to write javascript for selenium in built method? 您可能会想到为什么我们需要使用内置方法为硒编写javascript?

So selenium provide both way that you are prefer.But With "Action" we have to call inbuilt Java functions which are integrate with mouse. 因此,硒提供了您偏爱的两种方式。但是使用“动作”,我们必须调用与鼠标集成的内置Java函数。 And With "JavascriptExecutor" we have our implementation with modified code. 借助“ JavascriptExecutor”,我们可以使用修改后的代码来实现我们的实现。

This is main Advantage over inbuilt functions. 这是优于内置功能的主要优势。

:) :)

If you have any query comment me. 如果您有任何疑问,请评论我。
Thank You. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我们需要将Firefox驱动程序强制转换为javascript执行程序? - Why do we need to typecast Firefox driver to javascript executor? 为什么我们需要javascript mvc? - Why do we need javascript mvc? 为什么我们需要在JavaScript中定义构造函数 - Why we need to define constructors in JavaScript 通过在Selenium Webdriver的Javascript执行程序中使用Javascript XPATH获取iframe内容 - Get iframe content by using Javascript XPATH in Javascript executor for selenium webdriver 为什么 Promise 构造函数需要一个 executor? - Why does the Promise constructor need an executor? 无法通过 Selenium Webdriver 甚至 Javascript 执行程序滚动网页 - Cannot Scroll Webpage by Selenium Webdriver or even Javascript Executor 如何创建javascript执行器以使元素在selenium webdriver中可见 - How to create javascript executor to make element visible in selenium webdriver 我们为什么需要javascript:在进行内联javascript调用时 - why do we need javascript: while making inline javascript calls javascript (ES6):为什么我们需要集合? - javascript (ES6): Why do we need sets? 为什么我们需要IIFE在Javascript中进行模块作用域定义? - Why do we need IIFE's to have module scoping in Javascript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM