How can I pass direct xpath like a selenium in windows application

driver.findElement(By.xpath(’’//").click();

Please see this answer.

Windows.getDriver().findElement(By.id(‘username’)).sendKeys(‘mksrqa’)

11-14-2019 11:24:53 AM Test Cases/Test Case 1

Elapsed time: 19.423s

Test Cases/Test Case 1 FAILED.
Reason:
org.openqa.selenium.NoSuchWindowException: Currently selected window has been closed (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘EGW-DT-Q05’, ip: ‘10.10.25.20’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: io.appium.java_client.windows.WindowsDriver
Capabilities {app: D:\Repository\falcon-all\Co…, javascriptEnabled: true, platform: WINDOWS, platformName: WINDOWS}
Session ID: 7D0463B5-60F5-4675-9A90-DD0EA1BC5283
*** Element info: {Using=id, value=username}
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.execute(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.findElement(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:372)
at io.appium.java_client.DefaultGenericMobileDriver.findElementById(DefaultGenericMobileDriver.java:70)
at io.appium.java_client.AppiumDriver.findElementById(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.findElementById(WindowsDriver.java:1)
at org.openqa.selenium.By$ById.findElement(By.java:188)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:315)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.findElement(WindowsDriver.java:1)
at io.appium.java_client.MobileDriver$findElement.call(Unknown Source)
at Test Case 1.run(Test Case 1:31)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1573752289203.run(TempTestCase1573752289203.groovy:23)

Hi there,
I’m at the same situation,
seem Windows.getDriver().findElement(By.id(‘username’)).sendKeys(‘mksrqa’) doesn’t work for me

==========================
Windows.click(Windows.getDriver().findElements(By.id(‘submit-input’)))
Windows.setText(Windows.getDriver().findElements(By.id(‘submit-input’)), ‘http://google.com’)

got this exception
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords.click() is applicable for argument types: (java.util.ArrayList) values: [[]]
Possible solutions: click(com.kms.katalon.core.testobject.WindowsTestObject), click(com.kms.katalon.core.testobject.WindowsTestObject, com.kms.katalon.core.model.FailureHandling), wait(), collect(), find(), wait(long)

Please help me too, thanks!

(edit 21 July 2021)

Possibly you should type:

Windows.getDriver().findElement(By.id(...

You should type singlular findElement , not plural findElements .

oh, my bad :frowning: :frowning:
after that, I got this

Reason:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

I’m pretty sure that the locator is correct
do you have any idea/suggestion, thank you a lot!

No. I have no idea.

1 Like

Hello @duyluong
do you have any idea/suggestion/workaround for this issue, thank you so much!

I couldn’t find “Windows.getDriver().findElement(By.id(…”

it always showing Windows.getDriver().findElements - plural