Comments (21)
If I understand, you are trying to test whether clicking a button was successful? I assume you are running your tests remotely using a testing framework (e.g. pytest, mocha, nunit, or whatever).
It would be helpful if you have a specific example of scene and test framework to help you with. Otherwise, generally ...
Call the button.invoke() and wait for the HTTP request to finished then ...
You can test to see if an object has been destroyed by querying the hierarchy for the presence of the object, e.g. /q/scene/Some/Object
- if this returns []
then it wasn't found.
You can test to see if it is active with by looking at the activeInHierarchy
field for example /q/scene/Some/Object.activeInHierarchy
Same with any attributes you expect to have changed.
For loading a scene, the easiest way if to wait for a given length of time then see what the current scene is (using something like /about
or /q/scene/[0].scene.path
);
The more advanced way is to use websockets and bind to the sceneLoaded
event
{"id":"sceneLoaded","q":"/bind/events.sceneLoaded"}
Then you will get a message when a new scene is loaded.
HTH
from unium.
If I understand, you are trying to test whether clicking a button was successful? I assume you are running your tests remotely using a testing framework (e.g. pytest, mocha, nunit, or whatever).
It would be helpful if you have a specific example of scene and test framework to help you with. Otherwise, generally ...
Call the button.invoke() and wait for the HTTP request to finished then ...
You can test to see if an object has been destroyed by querying the hierarchy for the presence of the object, e.g.
/q/scene/Some/Object
- if this returns[]
then it wasn't found.You can test to see if it is active with by looking at the
activeInHierarchy
field for example/q/scene/Some/Object.activeInHierarchy
Same with any attributes you expect to have changed.
For loading a scene, the easiest way if to wait for a given length of time then see what the current scene is (using something like
/about
or/q/scene/[0].scene.path
);The more advanced way is to use websockets and bind to the
sceneLoaded
event{"id":"sceneLoaded","q":"/bind/events.sceneLoaded"}
Then you will get a message when a new scene is loaded.
HTH
I want to output the query results, such as the UI tree, attribute values to txt, where should I add the code, the JavaScript? Or where?
from unium.
.invoke() a
How to input a text into an inputField, like thi,:http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Accout/InputField/text.Text='20180001',but this is not successful
from unium.
Try Text.Text.text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Accout/InputField/Text.Text.text='20180001
First Text is the game object
Second Text the component
Then text is the field
from unium.
Try Text.Text.text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Accout/InputField/Text.Text.text='20180001
First Text is the game object
Second Text the component
Then text is the field
this is not successful!
from unium.
I want to output the query results, such as the UI tree, attribute values to txt, where should I add the code, the JavaScript? Or where?
Javascript console.log()
would seem appropriate, assuming this is for development (either in browser or from node.js).
from unium.
Try Text.Text.text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Accout/InputField/Text.Text.text='20180001
this is not successful!
If you run the unium tutorial scene, you should see an IP address in the top left. You can change the displayed text with the following query,
http://localhost:8342/q/scene/UI/IPAddress.Text.text=hello
Check this works for you ...
from unium.
Try Text.Text.text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Accout/InputField/Text.Text.text='20180001
this is not successful!
If you run the unium tutorial scene, you should see an IP address in the top left. You can change the displayed text with the following query,
http://localhost:8342/q/scene/UI/IPAddress.Text.text=hello
Check this works for you ...
Strange,it is not in the tutorial scene,the query http://localhost:8342/q/scene/Canvas/UIManager/win_login/Text.Text.text=hello,it is successful.
but the query
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text.text=hello,it is not successful.
from unium.
What is returned by the unsuccessful query?
from unium.
What is returned by the unsuccessful query?
from unium.
The empty array []
means no objects were matched by that query.
Easiest way to find what's failing is maybe to start with something that works and try adding bits until it fails, e.g. ...
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text.text
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text.text=hello
from unium.
The empty array
[]
means no objects were matched by that query.Easiest way to find what's failing is maybe to start with something that works and try adding bits until it fails, e.g. ...
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text http://localhost:8342/q/scene/Canvas/UIManager/win_login/inpu/Account/InputField/Text.Text http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text.text http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField/Text.Text.text=hello
Sorry,the unsuccessful query returned this
from unium.
So either the value it is trying to set it empty (which is unlikely), or the value can't be changed , in which case it is unity related.
You can put a breakpoint here to step through the code and see what's going on.
from unium.
So either the value it is trying to set it empty (which is unlikely), or the value can't be changed , in which case it is unity related.
Whether because the text is inside a inputField,not just a text.
from unium.
Possibly yes, can you change the value on the InputField instead?
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField.text=hello
or
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField.SetTextWithoutNotify(hello)
from unium.
Possibly yes, can you change the value on the InputField instead?
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField.text=hello
or
http://localhost:8342/q/scene/Canvas/UIManager/win_login/input/Account/InputField.SetTextWithoutNotify(hello)
both were unsccessful,reply empty array []
from unium.
Oops, I meant InputField.InputField
:)
from unium.
successful ,thank you very much!
from unium.
I want to output the query results, such as the UI tree, attribute values to txt, where should I add the code, the JavaScript? Or where?
Javascript
console.log()
would seem appropriate, assuming this is for development (either in browser or from node.js).
I want to output the returned array to a text instead of displaying it on a webpage or JavaScript console. Where should I add the code to a specific location in tutorial.js
from unium.
If I understand, you are trying to test whether clicking a button was successful? I assume you are running your tests remotely using a testing framework (e.g. pytest, mocha, nunit, or whatever).
It would be helpful if you have a specific example of scene and test framework to help you with. Otherwise, generally ...
Call the button.invoke() and wait for the HTTP request to finished then ...
You can test to see if an object has been destroyed by querying the hierarchy for the presence of the object, e.g.
/q/scene/Some/Object
- if this returns[]
then it wasn't found.You can test to see if it is active with by looking at the
activeInHierarchy
field for example/q/scene/Some/Object.activeInHierarchy
Same with any attributes you expect to have changed.
For loading a scene, the easiest way if to wait for a given length of time then see what the current scene is (using something like
/about
or/q/scene/[0].scene.path
);The more advanced way is to use websockets and bind to the
sceneLoaded
event{"id":"sceneLoaded","q":"/bind/events.sceneLoaded"}
Then you will get a message when a new scene is loaded.
HTH
I used http://localhost:8342/q/scene/about,it returned empty array[],used http://localhost:8342/q/scene/[0].scene.path,returned "Assets/Scenes/Game.unity".
And I don't know where to add or change the code with {"id":"sceneLoaded","q":"/bind/events.sceneLoaded"}
from unium.
The route for about is http://localhost:8342/about
(not /q/scene - its not a query :)
If you have multiple scenes http://localhost:8342/q/scene/*.scene.path
will return all of them although it may give you multiple results as it's returning the scenes of all the top level objects (or scene.name if you just want the name rather than the path).
Binding to events requires the websocket interface which I don't believe you're using.
from unium.
Related Issues (20)
- 1.0.5 ios socket bind not working HOT 1
- System.Reflection.AmbiguousMatchException with component functions that have multiple signatures HOT 7
- Binding to custom events HOT 1
- Passing complex objects through Invoke action HOT 1
- Full feature mobile UI automation tool. HOT 1
- how to change the main camera or player rotation? HOT 1
- trigger an event HOT 2
- Unity package import doesn't work due to missing meta-file HOT 7
- Cloned object paths cannot be resolved HOT 8
- Automate tap/click a toggle button HOT 2
- How to perform drag and drop? HOT 3
- Obtaining an image or its filename HOT 2
- automated_play not working correct HOT 5
- Make Unium class public? HOT 1
- Domain Reload Disabled support
- Maintenance of unium "API" HOT 3
- Websockets in Unity 2019 and 2020 HOT 9
- Unable to retrieve specific element instance with square brackets for objects with duplicate names/content HOT 9
- stacktrace should be part of events.debug data HOT 1
- How can I invoke an Event Trigger function? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unium.