GithubHelp home page GithubHelp logo

Comments (10)

NickAb avatar NickAb commented on June 16, 2024

Just use sendKeys with empty string as parameter. Each sendKeys call 'resets' input and sets it to the new value.

The driver uses automation pattern to set text on element, so it is not actual text input key after key, this means that special keys, like backspace will not work. We do handle enter, f1, f2 and f3 as special cases, but they will always be inputed last, regardless of their position in text. You an find more details in dirver implementation and in inner server implementation

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 16, 2024

Hi @NickAb
SendKeys is not able to input values in numeric field(field after parking on which number pad of OS gets opened).How to handle this situation then?,because you said in your reply above that it does not simulate key press.In Android(using Appium) we handled this scenario using Keys and it is working fine there.
Please suggest.

from winium.mobile.

NickAb avatar NickAb commented on June 16, 2024

I will need to reproduce this issue, can you provide minimal XAML needed to create input similar to that with which you have a problem? I am on vacation until Monday, so I will check this and see what can be done on the next week.

Meanwhile, one possible workaround is to use https://github.com/2gis/Winium.StoreApps/wiki/Command-Execute-Script#set-property-on-element to directly set property that holds the numeric value (but this is of course not a good solution).
If numpad is provided by OS, then its buttons will not be visible to driver, but still you can try calling Page Source when numpad is open and check for elements in xml that correspond to numpad keys. If by any chance they are available, then you will be able to click them using driver as a temporary workaround.

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 16, 2024

@NickAb .I will try your workaround and will get back to you.

Thanks and Regards,
Pranoday

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 16, 2024

Hi @NickAb
I wanted to get numeric value typed in edit field hence used
Driver.executeScript("attribute: set", ElementTobeClicked, "value", "10");

but this resulted in following stacktrace.

org.openqa.selenium.WebDriverException: {
"error": "unknown error",
"stacktrace": " at Winium.StoreApps.InnerServer.Commands.CommandBase.InvokeSync(CoreDispatcher dispatcher, Action action)\r\n at Winium.StoreApps.InnerServer.Commands.CommandBase.Do()",
"message": "Could not access attribute value."
} (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 215 milliseconds
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'pranodaydwin81', ip: '10.9.6.94', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.winium.WiniumDriver
Capabilities [{app=D:\magic\UP2\RIAModules\Windows10Mobile\MagicDev\MagicApp_1.0.0.0_x86_Test\MagicApp_1.0.0.0_x86.appx, debugConnectToRunningApp=false, deviceName=Mobile Emulator 10.0.10586.0 720p 5 inch 1GB, launchTimeout=10000, commandSettings={elementAttributeSettings={accessModifier=ClrProperties, enumAsString=false}}, platform=ANY, dependencies=[], launchDelay=0, autoLaunch=true, noFallback=true, files={}, pingTimeout=2500, takesScreenshot=true, platformName=WindowsPhone}]
Session ID: 872e1e32-35ce-4200-86b1-6434cad367f6
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:577)
at com.magicsoftware.TestAutomation.Utils.Utilities.EnterText_ByXpath_For_Winium(Utilities.java:5611)
at com.magicsoftware.TestAutomation.WinMobileTest.EnterTextInTableControl(WinMobileTest.java:3260)
at com.magicsoftware.TestAutomation.WinMobileTest.EnterTextInTableControlField(WinMobileTest.java:3218)
at com.magicsoftware.TestAutomation.TestCases.Data_Controls.P50(Data_Controls.java:898)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:659)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1032)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:137)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:58)
What could be the reason? May be I am setting wrong property value

Thanks and Regards,
Pranoday

from winium.mobile.

NickAb avatar NickAb commented on June 16, 2024

Could you please provide a bit of XAML to reproduce the numeric input?
I was able to successfully input number using SendKeys into numeric input created using following XAML

<TextBox InputScope="Number" AutomationProperties.AutomationId="NumericInput"/>

You can use Get Element Tag Name or Page Source to find out class of the input element if you do not have direct access to source code and XAML files.

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 16, 2024

@NickAb .I need to ask my manager whether I can share it with you or not.I will ask and get back to you.

Thanks and Regards,
Pranoday

from winium.mobile.

NickAb avatar NickAb commented on June 16, 2024

Of course, it would be great if you could just create a minimal app with single input element that you have problem with, so that nothing else gets published.

from winium.mobile.

Pranodayd avatar Pranodayd commented on June 16, 2024

@NickAb Sure.Will get back to you on this

from winium.mobile.

NickAb avatar NickAb commented on June 16, 2024

@Pranodayd any updates on this one?

from winium.mobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.