Interacting with website interface

Hi,

I have a mobile IP cam app of which I can acess settings from an interface in browser.
I would like to be able to control it from within TD, like mimeting the fact to press a button in this interface.

I’ve been working so far using headless browser technic following this post

It kind of works but it os not the most efficient to have to load an instance of the page before interacting with it, and somehow I can’t get the python library that I use ( selenium) to work in touchdesigner (even after updating the path to python libs as mention in the dedicated post)

Also this post is from 5 years ago so I was thinking a new, more efficient way of doing so might exist now and I’ve been researching around the web Dats but couldn’t find a way to make it work.

Have anybody been researching in this way and might point towards some documentation or examples?

Thanks!

1 Like

Ha, I wrote that post, and indeed these days there is a far better method!
As TD comes with a full chromium browser included now. See the Web Render TOP and the WebBrowser component in the Palette.

For your case, use the WebBrowser component which can be found in the Palette under Tools. You can even use the javascript parameter and the “send javascript” button to simulate pressing buttons in your interface.

hey, that’s progress,no? :wink:

Thanks! Yes that’s indeed pretty straight forward! I should make an habit of looking in the palette for solutions, so many interesting tools are laying there! And thanks for your previous solution with selenium, it was really intersting to experiment with it.

By the way do you know where I couls get some easy documentation for these javascript commands?
I have been looking at JavaScript HTML DOM and some forum posts and I’ve been trying something like:
document.getElementbyId("rec_button").InvokeMember("onclick")

but it didn’t work, actually even the default code which come in the javascript field is not working (but maybe it is because the derivative website changed in between)

thanks again!

After finding what I think is the good documentation on

I tried again this command (I’m sure of my button Id as it’s working with selenium)
document.getElementbyId("rec_button").click()

but it is not working

indeed the derivative website recently changed. If you try the default code on http://start.duckduckgo.com you’ll see the background change to yellow

So in the end I got it working great, I guess I might have had a typo that’s why it was not working.
For further reference the good way to click a button with the HTML DOM is

document.getElementbyId("buttonID").click()

1 Like

This is a great tool. Is there any way you guys know to pass a keystroke command, particularly right and left arrows, into the webBrowser using Python commands? I have a kinect that I’d like to convert gestures into right and left keypresses, but I’m stuck on how to do that. Thanks again.

@ctedin I don’t know particulary about arrows, but you could find some hints in another related thread where I had some similar problem