I use this code to show for example "phone status" activity :
Intent myIntent = new Intent(android.provider.Settings.ACTION_DEVICE_INFO_SETTINGS);
startActivity(myIntent);
now what address should I use to show call log activity ?
I don't want to use cursor to go through call logs !
I want to load the original "call log activity" not create a fake one.
thanks
I found the answer, should've called this intent :
Intent.ACTION_CALL_BUTTON
Related
I have an issue with setting value of AutomationElement by using method ValuePattern.SetValue().
Everything works just fine until some dialog appears. When the dialog appears the code execution got stuck. No exception is thrown. After the dialog is confirmed, the code exection continues. Bellow is a sample of the code:
BasePattern basePattern = null;
ValuePattern valuePattern = null;
AutomationElement elementA = Window.GetElement(SearchCriteria.ByText(propertyName));
object patternObjectA = null;
elementA.TryGetCurrentPattern(ValuePattern.Pattern, out patternObjectA);
basePattern = (BasePattern)patternObjectA;
valuePattern = (ValuePattern)patternObjectA;
valuePattern.SetValue(optionToSet);
// Window.GetElement() is a method from TestStack.White framework
// The code execution got stuck on the last line until the dialog is confirmed
Is there any other way to set AutomationElement value?
Is somehow possible to avoid of getting stuck by dialog?
I'll by grateful for any help.
Thanks advance.
It could be that this dialog is not supporting UI Automation correctly or that you simply target the wrong element.
To verify that you may use Inspect.exe from Microsoft or similiar tools.
If it works, check if you really target the correct component with your code again.
If it does not work and:
if you are able to change the application
you can change the so called AutomationPeer of the UI component - here is a link for more infos
Or simply use another UI component that supports UI Automation correctly.
if you are not able to change the application, and also do not need to run in background, parallel, etc.. you might just focus the component (call setFocus() onto the AutomationElement, or expand it (via IsExpandCollapsePatternAvailable or simulated MouseClick onto the components coordinates)) and then use the SendKeys.SendWait("test") method.
EDIT: There is one more thing you should have a look at, and I wonder why I didn't mentioned it in the first place: Register to UI Automation Events
For example you could register a callback for the Structure change event type, and check if the dialog you talk about appeared.
If so --> click the confirmed button of the dialog.
Probably you will have to synchronize your execution, so that every further action in the UI Automation script waits until the registered callback got executed and the confirmed button got clicked.
I'm using bootstrap tour, and everything is working fine.
What i'd like to do now, is create a "dismiss for now" button, that should display the tour next time the page is loaded.
In the local storage, when the tour ends, it creates a key called "tour_end" and the value is "yes", so, what i'm trying to do, is to call this:
tour.removeState("tour_end")
so that hopefully, next time the page is loaded, the key is missing and the tour will show up.
Unfortunately, the previous doesn't work, and it returns with this error:
_this.tour.removeState is not a function
any suggestion why this is not working? or the best way to achieve the "dismiss for now" behave?
Thanks a lot
Edit -
I solved this adding localStorage.removeItem("tour_end"); and it seams to work as expected.
I use an to show a message while running some code via a JsonRpcService. Works like a charm.
Now, I would like show a similar message saying "Please wait..." when the user submits a page. In this particular case it is logging in - where I need to read a lot of data to show the user. I submit the login info in a custom control when the user presses the icon (=button):
<xp:image url="/arrowGrey.png" id="submitButton" styleClass="submitButton" alt="Login" title="Login">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:Logon.submit()}]]></xp:this.action>
<xp:this.onStart><![CDATA[console.log('Start login');
setTimeout(function () {
XSP.openDialog('#{id:working}');
}, 300);]]></xp:this.onStart>
</xp:eventHandler>
</xp:image>
Logon is a managed bean. However, I never see the dialog box... - nor the "Start login" message?
The definition of the is:
<xe:dialog id="working" styleClass="inProgress">
<xp:div>
<xp:text escape="true" id="computedField1" tagName="h2" value="Logging in. Please wait..."></xp:text>
</xp:div>
</xe:dialog>
Any ideas as to how to obtain this?
The obvious next challenge is to close the dialog should the Logon.submit() fail validation and keep the user on the current page... :-)
If you are doing a Full refresh then the standby widget will not work. it only works on partial refreshes because a full refresh will reload everything on the page. But the standby widget is using a standard Dojo function that you could use.
Or what I usually do when I have some of code that needs to be executed. I send the users to a "please wait XPage" with an animated gif.
The trick is that the code can't start executing before the page and the gif is loaded so I add the code to a hidden button and in the onload event I click this button using client side JS that executed the backend code.
And when I'm done processing, I send them to the right page using context.reloadPage
This works very well.
Fredrik Norling created the very cool "Standby Custom Control" (http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control). It doesn't show a message but a spinning wait icon on every partial refresh that might endure longer as 200ms (you can tweak this down or up if you want to).
I'm automating an app that shows some overlay messages anywhere on the app for several scenarios, such as app installed for the first time etc. (I'm fairly new to Robotium too.)
The overlay displays a text that goes away by swiping or clicking on it. Also, there are different types of these overlays with different unique text on it. (let's call it Activity A)
I wanted to create a robust test case that handles this case gracefully. From the test's perspective we won't know that the activity A will be present all the time. But I want to recover from the scenario if it does, by writing a method that I can call any time. Currently, the tearDown method gets called since my expected activity name doesn't match.
Also, even if the activity A exists, there are other predefined overlay texts too. So, if I use solo.waitForText("abc") to check for text "abc", I may see the overlay 2 with the text "pqr" instead.
So I was looking for a way to automate this, and I can't use solo.assertCurrentActivity() or solo.waitForActivity methods as they just stop the execution after the first failure.
So any guidance is appreciated!
All the waitFor methods return a boolean. So you can use waitForActivity() exactly as you want to. If the Activity doesn't exist it will return false.
You can check which Activity is current:
Activity current = solo.getCurrentActivity();
I have five activity in my app,
Act1->Act2->Act3->Act4->Act5,
All activity goes in single direction as I have stated above,
Now I have to call again Act2 after successful completion of my Act5's task, so its working good and showing me the Act2 (I have Used startActivity(callIntent) in Act5 for showing me Act2 again),
After this when I click on Back button in Act2, I have Act1 (I have Used startActivity(callIntent) in Act2 for showing me Act1 again) its what I want .....
But the problem is that when I click Act1's back button it is going to put me on Act2. But I want to exit from there, because Act1 is the first initial activity.
How Can I set focus to my hidden activity , instead of creating Intent and call startActivity.
Any idea? Please help.
After long research I got pretty much understanding of "back stack" for all the activities in an app.
Each time I moved to another activity and also for opening previous activity I have used Intent.startActivity() with flag FLAG_ACTIVITY_NEW_TASK, So every time I have new activity added in the "back-stack".
I have tried intent flag as FLAG_ACTIVITY_CLEAR_TOP while calling previous activity from "back-stack" using Intent.startActivity() and I got the solution of calling back the previous activity and clears all stack top activity above the calling one activity. So now back button does working nice as I needed.
Let see My problem of calling previous activity ,
A = activity; A1->A2->A3->A4->A5->B2 , now if you click on back button you will have A1 activity , and after clicking on A1's back button you have again B2 activity which was called after A5 and so on.
After using the FLAG_ACTIVITY_CLEAR_TOP in A5 activity and called again A2 (Not creating new activity but calling precious one) I have following situation.
A = activity; A1->A2->A3->A4->A5
calling previous A2 activity, and I have following scenario.
A1->A2 only.
Thanks.
Instead of following code (with flag Intent.FLAG_ACTIVITY_NEW_TASK):
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setClass(CurrentActivity.this,PreviousActivity.class);
startActivity(callIntent);
Try using following one with Intent.FLAG_ACTIVITY_CLEAR_TOP
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
callIntent.setClass(CurrentActivity.this,PreviousActivity.class);
startActivity(callIntent);