Raising click event using JavaScript from Selenium

Skip to first unread message


Oct 20, 2019, 12:36:30 PM10/20/19
to cesium-dev
1. A concise explanation of the problem you're experiencing.
- I am trying to automate cesium viewer using Selenium. So far I have fetched the entity and fly to that entity. Now, I want to click on that entity so that the assigned event gets fired.
I am pretty new to cesium, help will be highly appreciated. 

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
string script = @"viewer.render();
                                var dataSource = viewer.dataSources._dataSources[1];

                                if (dataSource) 
                                    for (var i = 0; i < dataSource.entities._entities._array.length; i++)
                                        var name = dataSource.entities._entities._array[i].name.toString();
                                        if (name.includes(""" + name + @"""))
                                                viewer.flyTo(dataSource.entities._entities._array[i], {duration: 5});

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
- As listed above, to automate the testing process using Selenium.

4. The Cesium version you're using, your operating system and browser.

Omar Shehata

Oct 27, 2019, 7:39:27 PM10/27/19
to cesium-dev
Is the click event not working? Are you getting an error?

You should be able to simulate a click on the canvas and CesiumJS will pick it up. If you need to wait for the entity to finish loading, or for the camera to fly to the entity, notice that the flyTo returns a promise, so you can do:

//Your picking/clicking code here
Reply all
Reply to author
0 new messages