Unable to Clear TextField in Appium Android Automation - appium-android

I used the below code:
web.sendKeys(Keys.chord(Keys.CONTROL,"a"));
web.sendKeys(Keys.BACK_SPACE);
This method almost worked, it cleared first, and is entering an alphabet a, dont know y, I tried element.sendKeys(Keys.Delete); but still no luck, attached is the screen after the method was executed.
enter image description here

The clear function should provide what you're looking for:
element.clear()
Documentation on this can be found in the official Appium documentation.

element.clear() would work but if you actually need to delete something you can use exactly what you have except like this
web.sendKeys(Keys.chord(Keys.CONTROL,"a"));
web.sendKeys(Keys.BACKSPACE);
no _ in BACKSPACE
keep in mind if you want to delete a characters before the cursor use Keys.BACKSPACE, to delete characters after the curser use Keys.DELETE

Related

Error handling in Sublime Text Plugin API

I'm creating my first sublime plugin to be used internally and was wondering if there's a way to stop the plugin from executing and display an error message on screen like an alert?
I took a look at view#show_popup() but this didn't render for me. Below is how I attempted to show it:
if "WebContent" in subdirectories:
directory = ROOT_DIR + "/WebContent"
elif "Content" in subdirectories:
directory = ROOT_DIR + "/Content"
else:
self.view.show_popup('Directory not found', location=-1)
Working Principle:
The plugin takes some data from one view and then pastes them in another view. The plugin has two TextCommands. One command takes the data from the first view, opens a new view and then executes the 2nd command on the new view. The above snippet is in the 2nd command.
I was unable to find any resources to help with show_popup() or any other error handling.
Does any one have possible ideas?
view.show_popup() is for showing things like hover popups next to the cursor; it's used for things like the built in functionality for going to references/definitions for functions:
While you could in theory use this for error messages, it may not be the sort of user experience that anyone would expect.
Your code above is technically valid, but since the content is expected to be minihtml it may be hard to see because as just a single string all you're going to see is just the text (i.e. you have no font style, padding, etc):
Perhaps more importantly, when location is -1, the popup appears at the point in the buffer closest to the first cursor position, so depending on your circumstance it may be appearing in a place you don't expect, and then vanishing away before you can scroll to see it, etc.
What you want here is sublime.error_message(); given a string, it will display that string in a dialog for the user to interact with, and it also logs the error into the Sublime console as well so that there's an additional trace.

When shrink litedb files then app cannot find index on <collection>._id. How could i fix it?

I use 3.xx version of litedb and want to shrink the file since it always grows its size.
I shrunk it using LiteDbExplorer's "shrink" button, but now app cannot use this db file.
But still it seems good when using viewer litedbexplorer, litedbviewer, litedbstudio.
I can see data well on these viewers.
but when run application then
it shows
message like "LiteDB.LiteException: Index not found on '<collection_name>._id',
at LiteDB.Query.Run(CollectionPage col, indexService indexer)
at
LiteDB.LiteEngine.<>c__displayClass14_0.b__0(Collectionpage col) ~~~..."
Did I make it broken?
but Index on _id(primary key) and other indexes still exist well.
I check it using "db.collectionname.indexes".
anybody help me through?
It was because of collections' name restriction.
If collection's name is not fit then it cannot manipulate itself, not only its documents.
And also LiteDBExplorer's shrinking function might have some problem.
It does not work always, but LiteDBshell works.
Please use "db.shrink" at shell.
I guess messages like "Invalid format: Collection" at shell can be fixed by changing collection's name.

AutoHotKey ControlGet

I have a script that is throwing and error when I issue a ControlGet.
OtPtVar := AfxWnd422
strMPP := Material Planning Profile
ControlFocus,%OtPtVar%,,%strMPP%
Control,Show,,%OtPtVar%,,%strMPP%
These all work but when it gets to the next line it throws an error:
ControlGet,sysList,List,,%OtptVar%,,%strMPP%
The control is a grid with five fields row number,Part,Description,Time,Lateness.
`ControlFocus,%OtPtVar%,,%strMPP%`
`Control,Show,,%OtPtVar%,,%strMPP%`
`ControlGet,sysList,List,,%OtPtVar%,,%strMPP%`
The error occurs on the last line.
Thank you.
After searching the AutoHotKey site I found to the following:
Those Afx window classes were custom classes distributed with early versions of MFC, before the "Common Controls" concept was introduced.
Many people have tried to "read" text from them but you CAN'T, not with messages anyway!
They're almost certainly owner-drawn - the text is not delivered by messages, it's "hand-drawn" into the window's DC
...
Messages are a dead-end I think - those who have pursued this problem must have already clocked up several hundreds of hours of monitoring message traffic between them!
So its not possible to get a hold of the control.
ControlGet's List subcommand can only handle standard listview controls, which usually have the class 'SysListView32'.
Did you try AccViewer just in case.
This link mentions textcapturex by Deskperience Software in case that helps.
"AfxWnd42s" Please Help - AutoIt General Help and Support - AutoIt Forums
https://www.autoitscript.com/forum/topic/49057-afxwnd42s-please-help/
There are theoretically process hacker methods,
but I'm not an expert on those, and wouldn't recommend such methods.
And yes, unfortunately when I really needed to, I used OCR once.
Potentially you can do OCR, recreate the text in the same font,
and check for an exact image match as a double-check.
Also, if possible, set the font to one where characters such as capital i and small L are unambiguous.

View raw markdown of GitHub comment

How can I view the Markdown of a comment in a GitHub issue? For example, I would like to see the Markdown that makes up this comment:
https://github.com/jashkenas/backbone/issues/3857#issue-116738665
Simply replace username, reponame and issue number in the following url:
https://api.github.com/repos/USERNAME/REPONAME/issues/NUMBER/comments
Here's an example
First, the first post is the actual issue itself, not accessible but the GitHub issue API:
https://api.github.com/repos/jashkenas/backbone/issues/3857/comments
That list only 3 comments, since the first post is not a comment.
The issue itself has a formatted body:
https://api.github.com/repos/jashkenas/backbone/issues/3857
That returns:
"body": "In Safari , pass a path using unicode string to `navigate` method like this\r\n\r\n```js\r\nBackbone.history.navigate('/city/北京',{trigger:true});\r\n```\r\nThe hash is incorrect. It output\r\n\r\n```js\r\nlocation.hash\r\n//> #/city/%17%AC\r\n```\r\n\r\nI tracked the code, it caused by `_updateHash` method.\r\n\r\nThe call stack created by `History.prototype.navigate` method like this\r\n\r\n* navigate\r\n - decodeFragment\r\n - _updateHash\r\n\r\nThe fragment passed to `_updateHash`, was decoded by `decodeFragment`, so the hash was incorrect。\r\n\r\nI also searched the commit history, the `decodeFragment` added in \"1.2.0\"\r\n\r\nPS: My english is not good, although I am trying to improve\r\n\r\n",
That is not exactly mardown:
In Safari , pass a path using unicode string to `navigate` method like this
```js\r\nBackbone.history.navigate('/city/北京',{trigger:true});
```\r\nThe hash is incorrect. It output
```js\r\nlocation.hash
//> #/city/%17%AC
```
I tracked the code, it caused by `_updateHash` method.
The call stack created by `History.prototype.navigate` method like this
* navigate
- decodeFragment
- _updateHash
The fragment passed to `_updateHash`, was decoded by `decodeFragment`, so the hash was incorrect。
I also searched the commit history, the `decodeFragment` added in \"1.2.0\"
PS: My english is not good, although I am trying to improve
The second comment in this issue has two images, so those fancy effects are no markdow:
https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif
[https://jsfiddle.net/leexiaosi/uyp3o6ek/](https://jsfiddle.net/leexiaosi/uyp3o6ek/)
**notice!!!** : please open in safari.
### the record of safari
![safari](https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif)
### the record of chrome
![chrome](https://cloud.githubusercontent.com/assets/516562/11164583/c66d1b82-8b2f-11e5-9d88-ecba16ae6167.gif)
It's probably late. But I could somewhat do it this way (at least in firefox).
I am assuming your intention is to copy the formatting of the comment.
This is not an exact solution, but since GitHub supports HTML tags in comments, this will work just fine.
Right click somewhere at the top of the comment you want to copy.
Inspect element
In the Inspect Element box, you will find a line that's a few lines above the highlighted line which has this code:
<td class="d-block comment-body markdown-body js-comment-body">
Right click on the line having the above code
Select Copy>Inner HTML
Now you can either paste this in a comment box, preview it and you'll be able to see the same formatting, OR use an online HTML to MD converter.
You can see the raw markdown by using "Quote reply" (found after clicking three dots at top right of a comment.
Here's the beginning of the comment you asked for:
In Safari , pass a path using unicode string to navigate method like this
Backbone.history.navigate('/city/北京',{trigger:true});
The hash is incorrect. It output
location.hash
//> #/city/%17%AC
...

Using barcode scanner to read barcode in forms 10g

I want to use barcode to read instead of using input from keyboard. I use Key Enter trigger and passing null against it but it did't fire. Any solution.....
I Googled for it and found this article. The pertinent line is
"In order to cause the key-next-item to execute you will need to ensure
the bar code reader sends a TAB key sequence at the end of each scan
so that the key-next-item trigger will fire."
I don't know whether that will solve your problem but the solution will probably be something along those lines: configuration of the reader.