question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add `windowById` helper

See original GitHub issue

as @kevinsawicki points out here https://github.com/electron/spectron/issues/6:

ChromeDriver seems to treat each <webview> tag as a separate window so you should be able to use the windowByIndex helper to focus a webview by location in the DOM and then you can call other helpers and it will be scoped to that window.

if you have multiple webviews, then working with just the index is very error prone. Would it be possible get the webview based on its id? Something like: windowById('#my-webview)?

Or could we maybe already achieve this with a couple of promises? I tried but couldn’t make it work. Any idea’s?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
gautazcommented, Dec 19, 2016

I am also having the same issue.

Currently I am locating a particular element’s id contained by the targeted webview by iterating over all window handles.

I’m using something like that:

const selectWindow = async function(app, selector) {
  const handles = await app.client.windowHandles();
  for (const handle of handles.value) {
    await app.client.window(handle);
    const element = await app.client.element(selector);
    if (element.status === 0) {
      return element;
    }
  }
  return {};
};

But processing this way seems rather awkward, inefficient and also error prone (duplicate element ids in two different webviews is authorised).

webdriverio window() call is able to retrieve a window by using the tab name attribute but I do not know if there is a way to associate a tab name to a webview element.

2reactions
kevinsawickicommented, Dec 19, 2016

I am pretty sure that you are already a lot busy with all the other issues but perhaps can you come up with a better work around than the current one ?

Nothing I can think of initially but I think something could be added, will have to investigate further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calibration and align batch operations | PixInsight Forum
windowById (): invalid view identifier. Click to expand. ... There is a bug at line 250 of BatchPreprocessing-helper.js. The line read:
Read more >
electronjs - Bountysource
I'm trying to find a way of effectively testing for IPC events being sent/received on either the main or renderer processes. Looking at...
Read more >
Is it a good practice to combine design patterns in JavaScript
I have my helper function (this function is just an example): var someElement = byId('id');. Of course I can create HelpersModule in ...
Read more >
How to check if a window is valid? - wxWidgets Discussion ...
Or, as alternative: Is there a way to install some sort of global "Hook" with wich I can automatically add EventHandlers for ...
Read more >
Automated Malware Analysis Report for https://sites.google.com/site ...
Valid Accounts, Graphical User Interface1, Winlogon Helper DLL ... getElementById(a)}window.byId=d;function g(a){return ... Please add a description.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found