How to scroll bottom and click the button using karate-appium? - appium

I have a button named just the symbol ">". I want to click the button to move next window. I tried the following code, but it's not working.
And driver.script("mobile: scroll", { "strategy" : "accessibility id", "selector": ">" })
And driver.optional('#>').click()
stopped in this line And driver.script("mobile: scroll", { "strategy" : "accessibility id", "selector": ">" }).
need help. #peter_thomas, #babu_sekaran, or someone

Related

SwiftUI ActionSheet disabled button

This seems like maybe a simple question, but I'm looking for a way to make one (or more, I suppose) buttons in an ActionSheet in SwiftUI to be disabled. For example, if something is illegal based on the state of the app, I don't want to let the user click the button - indeed, I might change the text to explain why it's disabled.
Xcode autocomplete isn't really turning anything up for me, and the docs (here and here) aren't giving me anything. Is my best/only option simply not putting the button in the list of buttons in the ActionSheet? (And kinda letting the user infer why it's not there...)
Thanks so much for any advice!
My simple code:
private func getActionSheet() -> ActionSheet {
let buttons: [ActionSheet.Button] = [
.default(Text("This is fine...")) { foo() },
.default(Text("This is forbidden - disable me!")) { foo() },
.cancel()
]
return ActionSheet(title: Text("Do it!"), buttons: buttons)
}
For nondestructive actions you can simply show a Menu. They support the .disabled(true) modifier.
var body: some View {
Menu("Do it!") {
Button("This button works fine", action: { })
Button("This one is disabled", action: { })
.disabled(true)
}
}

SCLAlertView Button

When I used third party SCLAlertView there was a problem actually there is a problem that is I want to perform some action when the button will pressed but there is just the customization properties but I am wondering for the action scope can someone help me out?
you can use this
let appearance = SCLAlertView.SCLAppearance(
showCloseButton: false // if you dont want the close button use false
)
let alertView = SCLAlertView(appearance: appearance)
alertView.addButton("Ok Pressed") {
print("Ok button tapped")
}
alertView.showSuccess("Success", subTitle: "")
you get the detail example for add buttons and hide default close buttons property in SCLAlertView
I never used this library, however if we take a look at the Github repo of the project (https://github.com/vikmeup/SCLAlertView-Swift) we will see the following example:
alert.addButton("Show Name") {
print("Text value: \(txt.text)")
}
Where print("Text value: \(txt.text)") gets executed after clicking the button.

IBAction on button won't be called in custom keyboard

I am making a custom keyboard that has a search bar. In order for a user to be able to interact with it, they must be able to:
1- Input text with individual letter buttons.
2- Tap the search button.
As for number 1, I have working IBActions that are called at every button press. For example, here's the action for the letter "m":
#IBAction func mPressed(button: UIButton) {
searchBar.text! += "m"
}
However, the search button IBAction will not call:
#IBAction func searchPressed(button: UIButton) {
print("searchPressed")
}
When I connect the search button in storyboard to the "mPressed" action, that action is called. But when I reconnect it back to the "searchPressed" function above, it doesn't work again.
I have also made sure that I correctly connected the button to the action.
The search action is connected to the search button
The 'm' action is connected to the 'm' button
Thanks!
In your screenshot search button connected to method searchButtonPressed, but in code you have method searchPressed.
Delete connection to searchButtonPressed and reconnect to searchPressed and it will work.

Removing "bar" above the iphone keyboard

In an iPhone app, when the user clicks a UITextField, this keyboard is displayed. I would like to remove the bar/area containg "<", ">" and "Done".
Any suggestions how to do that?
SOLVED
It turned out that it was IQKeyboardManager that was adding the bar on top of the keyboard.
It was removed by this line in AppDelegate file:
IQKeyboardManager.sharedManager().enableAutoToolbar = false
try :
self.<yourTextField/View>.inputAccessoryView?.hidden = true

Disable button in MT.Dialog and change image

Can anyone help, i want to change my image(button), when i press my buttonImage i open MT.Dialog and then i login, and when i login i want the button to change how do i do that, i have found the code, but it doesn't work in MT.Dialog
Here is how i do it.
cmdLogin.TouchUpInside += delegate {
cmdLogin.SetImage(UIImage.FromFile("Images/Logout.png"), UIControlState.Normal);
};
and for the hidden thing i tried(But doesn't work)
if(cmdLogin.Hidden == True)
{
cmdLogout.Enabled;
}else{
cmdLogout.Hidden;
}
but that doesn't work in MT.Dialog ofcourse because i don't do anything with my string element(My string element got the name login and if someone got a link to a good login system w/ database that would be very helpful.
and ofcourse here is my MT.Dialog code
cmdLogin.TouchUpInside += delegate {
_window.RootViewController = new DialogViewController(new RootElement("Login") {
new Section ("B.V. Electronic"){
(password = new EntryElement ("Password", "", "", true))
},
new Section () {
(login = new StringElement ("Login", delegate {
if(password.Matches("1234")){
GoBackToView();
}else{
new UIAlertView("Wrong code", "It's the wrong code", null, "Ok", null).Show();
}
}))
},
new Section (){
new StringElement ("Cancel", delegate {
GoBackToView();
})
}
});
};
I am not real clear on exactly what you want to do. However, one suggestion I have for you is to look at this:
https://github.com/xamarin/prebuilt-apps/tree/master/FieldService
This is a sample application that was built by Xamarin that has a nice login screen that you could try and get some ideas from. It does not use Monotouch.Dialog for the login screen, so if you want that you can look at this:
http://docs.xamarin.com/recipes/ios/content_controls/tables/create_a_login_window_using_monotouch.dialog
Your code is similar to that, but it looks like you modified it a little.
If you want to change your Login StringElement, you need to modify it, then call Root.Reload(login, UITableViewRowAnimation.Automatic); afterwards. I don't think there is a simple way to just change the background image of a StringElement. You will need to make your own subclass of StringElement and customize the GetCell() routine to. You can refer to this SO question for more ideas on that:
How can I create a custom styled EntryElement with MonoTouch.dialog?
I hope that helps.

Resources