Sorry if this is really basic, I cannot find a workaround. I have a variable called doc
that stores the number 510 that was copied from an excel cell.
I need to type it in a field, but I need to continue typing in another field on the same page afterwards.
My code has:
type(doc)
The log shows:
[log] TYPE "510#ENTER."
The full code looks like this:
type(doc)
wait(1)
type(Key.DOWN)
type(Key.BACKSPACE+Key.BACKSPACE+Key.BACKSPACE+Key.BACKSPACE)
wait(1)
type(code)
However, I can't get to the type(code)
because it switches page before I get there...
Using paste()
maybe solved your issue here but this is not the right way to do that as Sikuli does not automatically presses any buttons.
Your problem is probably with the doc
variable itself. In your case, you probably just copied the new line character with your variable from excel and that's why Sikuli is hitting Enter. To avoid that, try stripping the new line from your variable prior to typing it, like this:
doc.rstrip()
Then do your usual type(doc)
and it should be fine.