1

I am using Cefsharp.Offscreen project for some automation. I am in a case where I want to perform some DOM operations to select elements and trigger events on it.

  • Every single javascript call does not return my elements I want to select.
  • If I take a screenshof of the page it looks correct
  • If I execute the same javascript inside the Chrome console, it works

I think I missed something somewhere.

Thank you very much

Bhaal22
  • 715
  • 4
  • 10
  • CefSharp JavaScript calls can only return simple objects like strings and numbers. Perhaps this is your problem. Or it could be a timing issue - does the same call work in the WinForms control? If you post your code it will be much easier to help you. – Yoshi Jul 01 '16 at 22:07
  • Open devtools to see what's going on – amaitland Jul 01 '16 at 23:23
  • Dont think the problem is a timing issue. The repository is at this place : https://github.com/Bhaal22/user-xp/tree/master/cef/o365 the last commit introduces some mess where I tried to play with Frames. I cant really sahre the credentials of the website I test but this is one from Sharepoint online o365. I will test to enable debug monde on my CefBrowser instance. In the code provided in the repo, as you can see, I wait already 15 secs to make the rendering which is nice. Then After, I try to click on a button via javascript and it does not work. – Bhaal22 Jul 04 '16 at 08:41
  • Looks like my page was not fully loaded when I tried to use DOM elements. Increased my sleep ... will check to have an accurate load state information. – Bhaal22 Jul 04 '16 at 21:57
  • If your `DOM` is generated dynamically then you can probably use a `MutationObserver` to determine when the relevant elements have been added and call back into `c#` using a bound object (see the `FAQ`). http://stackoverflow.com/questions/13277212/mutation-observer-for-creating-new-elements – amaitland Jul 04 '16 at 23:07

0 Answers0