小编TDH*_*DHM的帖子

无法执行本机交互:无法为Selenium-webdriver 2.35.0和Firefox 23.0.1组合加载本机事件组件

为了自动化其中一个测试,我将执行拖放操作.因此,我尝试按照以下方式实现:

driver.action.drag_and_drop(source, target).perform
Run Code Online (Sandbox Code Playgroud)

但它导致错误:

Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events component.
Run Code Online (Sandbox Code Playgroud)

我在以下配置上运行了此测试:

  1. Firefox 23.0.1
  2. Selenium WebDriver 2.35.0

我选择了上面的组合,因为更改日志说 - 使用Selenium WebDriver 2.35.0和Firefox 23,本机事件组件工作正常.

即使我使用了正确的Firefox和Selenium WebDriver版本,它也会抛出错误.

看看stackoverflow,我可以看到几次问过同样的问题.这些问题的答案如下:either downgrade/upgrade Firefox, Selenium WebDriver versions

每次升级Firefox或Selenium WebDriver版本时,用户都会面临这些问题.因此,用户查看更改日志并尝试找到Firefox和WebDriver的正确组合.(即使我跟着它,我也面临着问题)

我的问题是:

  1. 有没有最简单的方法来帮助选择正确的Firefox和Selenium WebDriver版本?
  2. 或者是否有使用Selenium进行鼠标交互的解决方法?

这样我们就可以摆脱Cannot perform native interaction: Could not load native events component.错误.

ruby selenium selenium-webdriver

5
推荐指数
1
解决办法
1223
查看次数

getLocation() Selenium WebDriver API 返回值的理解

在 Selenium WebDriver API 中,有一个getLocation()返回点的方法,包含元素左上角的位置。比方说,它返回(x, y)

(x, y)与桌面(浏览器处于全屏模式时)屏幕分辨率或视口(视口,浏览器窗口内网页的可见区域)分辨率相关的点吗?

编辑

根据我对这个问题的回答,我可以猜测getLocation()返回点是各自桌面的屏幕分辨率或整个浏览器的(包括工具栏、搜索栏等)而不是视口的。我只是想确保如果我的想法是正确的,如果是,为什么getLocation()会做出这样的行为?是否有任何 Selenium WebDriver 方法,它将返回与视口相关的元素点?

如果我错了,请纠正。

selenium selenium-webdriver

5
推荐指数
1
解决办法
3万
查看次数

从 json 数组中删除 json 对象

我有一个像这样的 JsonArray:

"fields" : [
    {
      "name":"First Name",
      "id":1
    },
    {
      "name":"Middle Name",
      "id":2
    },
    {
      "name":"Last Name",
      "id":3
    }
]
Run Code Online (Sandbox Code Playgroud)

我想从上面的 JsonArray 中删除第二个 JsonObject。为了做到这一点,我编写了以下代码:

JsonArray fieldsObject =jsonObject.getJsonArray("fields");
fieldsObject.remove(fieldsObject.getJsonObject(2));
Run Code Online (Sandbox Code Playgroud)

但第二行抛出错误:java.lang.UnsupportedOperationException

有什么办法可以从 JsonArray 中删除 JsonObject 吗?

java json

5
推荐指数
1
解决办法
1万
查看次数

如何在管道的后段定义变量?

我想在管道的后段中的不同条件下使用一些共同的值,因此我尝试以下 -

1.

post {  
      script {
           def variable = "<some dynamic value here>"
      }
      failure{
           script{
                  "<use variable  here>"
           }
     }
     success{
          script{
                "<use variable  here>"
         }
    }
}
Run Code Online (Sandbox Code Playgroud)

2

post {  
          def variable = "<some dynamic value here>"
          failure{
               script{
                      "<use variable  here>"
               }
         }
         success{
              script{
                    "<use variable  here>"
             }
        }
    }
Run Code Online (Sandbox Code Playgroud)

但它会导致编译错误。

您能否建议我如何在post部分中声明一个可以跨条件使用的变量?

jenkins jenkins-groovy jenkins-pipeline

5
推荐指数
1
解决办法
4393
查看次数

Java 内置 JSON 解析器

我一直在处理一项任务,我需要在 JSON 中发出请求并获取特定键的值。由于一些限制/复杂性,我假设只使用内置的 Java 库。

为了提出请求,我正在使用,HttpURLConnection但为了解析我找不到的 JSON。您能否在内置 JSON 解析器中向我指出 Java。

我在这里找到了类似的问题但没有令人满意的答案,而且很旧,因此再次询问,以防万一,最新版本的 Java 可以使用此问题。

java json

5
推荐指数
1
解决办法
3392
查看次数

何时使用%w?

以下两个语句将生成相同的结果:

arr = %w(abc def ghi jkl)
Run Code Online (Sandbox Code Playgroud)

arr = ["abc", "def", "ghi", "jkl"]
Run Code Online (Sandbox Code Playgroud)

在哪些情况下应该%w使用?

在上面的例子中,我想要一个数组["abc", "def", "ghi", "jkl"].哪种理想方式:前者(带%w)或后者?

ruby arrays

4
推荐指数
1
解决办法
1619
查看次数

How to check if radio button is selected or not using Selenium WebDriver?

<div class="my_account_module_content">
<h3 class="my_account_module_content_title">
Mi Dirección 1
<br>
<span>Predeterminada</span>

<div class="selectCard_left">
<input id="17390233" class="default_shipping_address" type="radio" name="address" checked="true">
<span>Seleccionar como tarjeta predeterminada</span>
</div>
Run Code Online (Sandbox Code Playgroud)

this is the HTML code

If radio button selected is true then print the class span value? please help me..

selenium webdriver selenium-webdriver

4
推荐指数
1
解决办法
2万
查看次数

如何使用Selenium WebDriver处理文件下载弹出窗口?

我已经编写了一个代码来下载excel文件,它正在工作,但是一旦弹出窗口出现,它就会停止。它会自动下载文件并将其存储在指定的位置,现在不会发生这种情况。请任何人帮助找到解决此问题的方法

FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(profile); 


profile.setPreference("browser.helperapps.neverAsk.saveToDisk" , "text/csv"); 
profile.setPreference("browser.download.folderList", 2); 
profile.setPreference("browser.download.dir","e:\\SampleExcel"); 

driver.get("http://url");
driver.findElement(By.name("email")).sendKeys("abc@gmail.com");
driver.findElement(By.name("pass")).sendKeys("abc");
driver.findElement(By.id("edit-submit")).click();
driver.findElement(By.id("toolbar-link-admin-config")).click();
driver.findElement(By.linkText("Reports")).click();
driver.findElement(By.xpath("//input[@value='5']")).click();
driver.findElement(By.id("edit-submit")).click();
Run Code Online (Sandbox Code Playgroud)

selenium-webdriver

4
推荐指数
1
解决办法
2万
查看次数

的意思 ?在 Map&lt;String, ?&gt;

createBuilderFactoryjavax.json类型的需求论证Map<String, ?>

通常,我们有类似的映射Map<String, String>(一些其他数据类型代替String

但我不明白什么?代表什么。为了传递 type 的参数Map<String, ?>,我应该如何定义地图。

有人可以帮助我更好地理解这一点吗?

java generics collections

4
推荐指数
1
解决办法
9851
查看次数

如何将身份验证详细信息传递给 iframe 内的应用程序?

我有一个网页,想在其中显示 Jenkins 的网页,因此使用iframe如下 -

<html>
<head>
    <title>Dashboard</title>
</head>
<body>
    <iframe src="http://xxx.xxx.xx.xx:8080/view/Nightly%20Builds%20/" width="100%" height="100%"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

但是http://xxx.xxx.xx.xx:8080/view/Nightly%20Builds%20/打开登录页面,因此无法直接显示内容。其实我想在没有登录的情况下显示页面的内容。

有什么方法可以将身份验证详细信息/令牌传递给框架内的网站?

html javascript authentication

4
推荐指数
1
解决办法
7432
查看次数