Click may not work when using the electron app from selenium

Asked 2 years ago, Updated 2 years ago, 81 views

Overview

·I tried to operate the electron app from selenium, but the click operation does not work.·There are cases where the click operation is different from the specified location.
·If you use the electron app yourself, it works fine.

Does anyone know what's going on?

environment
·MacBook Pro/OS X Yosemite (10.10.4)
·Electron
 ·v0.33.1
 ·v0.36.1
·ChromeDriver
 ·chromedriver-v2.15-darwin-x64
 ·chromedriver_mac32_2_20
·jQuery
 ·1.11.3

Details

First of all, I have made the following HTML into an Electron app.

<html>
<head>
...
<script>
window.jQuery=window.$=require("jquery");

$(function(){
  $("#link1").click(function(){
    $("#status1").text("OK");
  });

  $("#link2").click(function(){
    $("#status2").text("OK");
  });

  $("#link3").click(function(){
    $("#status3").text("OK");
  });
});
</script>
</head>

<body>
<span id="status1">/span><a href="#1" id="link1" class="link">link1</a>br>
<span id="status2">/span><a href="#2" id="link2" class="link">link2</a>br>
<span id="status3">/span><a href="#3" id="link3" class="link">link3</a>br>
</body>
</html>

"When I started the app and pressed each link, ""OK"" appeared in front of the link, and I confirmed that it was working as expected."

Next, I wrote the following ruby code (excerpt) in Selenium.

...
link1 = driver.find_element(:id, 'link1')
link1.click

sleep(5)

link2 = driver.find_element(:id, 'link2')
link2.click

sleep(5)

link3 = driver.find_element(:id, 'link3')
link3.click
...

If you do this, link1, link2 will be fine, but only link3 will not show "OK".

Does anyone know what's going on?

html, if you add a similar link4 to the code, an app-side link4 event will occur during the selenium link3.click operation. (???)

Thank you for your cooperation.

electron selenium-webdriver

2022-09-30 14:32

1 Answers

This didn't happen in my environment, and I could only make it work as expected with Electron.
Other than Electron and WebDriver, for example, you may want to follow:

  • The test and test object do not match, for example, the specified chromeOption.binary on the WebDriver side is an old build Electron app
  • The Node.js version is older
  • The developer console is displayed and the processing context has changed
  • MacBook Pro/OS X Yosemite (10.10.5)
  • jQuery
    • 1.11.3
  • Node.js
    • 5.3.0
  • Selenium
    • 2.48.2
  • 1.11.3
  • 5.3.0
  • 2.48.2

Electron and ChromeDriver both worked in the following combinations:

  • Electron 0.33.1 + ChromeDriver 2.15
  • Electron 0.36.1 + ChromeDriver 2.20


2022-09-30 14:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.