0

I am automating a login with python and winappdriver. The versions I am using are: Appium-Python-Client 0.24 selenium 3.14.0 Windows Application Driver 1.2.99

My code is the following:

import time, os
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from time import sleep

host="localhost"
port=4723

os.system(r'start "" /d "C:\Program Files\Windows Application Driver\" "WinAppDriver.exe"')
desired_caps = {}
desired_caps["platformName"] = "Windows"
desired_caps["deviceName"] = "WindowsPC"
desired_caps["ms:waitForAppLaunch"] = "8"
desired_caps["app"] = "C:\example.application"

driver = webdriver.Remote(command_executor='http://{}:{}'.format(host, port), desired_capabilities= desired_caps)

username = "user"
password = "mypass"
user_box=driver.find_element_by_accessibility_id("userid")
pwd_box=driver.find_element_by_accessibility_id("passid")
login_button=driver.find_element_by_accessibility_id("btnlogin")
user_box.send_keys(username)
pwd_box.send_keys(password)
login_button.click()

The problem is that I have the following error:
  File "C:\Users\User\Documents\Examples_python_selenium\test calculator.py", line 17, in <module>
    driver = webdriver.Remote(command_executor='http://{}:{}'.format(host, port), desired_capabilities= desired_caps)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: The specified executable is not a valid application for this OS platform.

What is wrong or what am I missing?

  • Does this answer your question? [The specified executable is not a valid application for this OS platform. Selenium.ChromeDriver, StartWithCreateProcess(ProcessStartInfo startInfo)](https://stackoverflow.com/questions/56096458/the-specified-executable-is-not-a-valid-application-for-this-os-platform-seleni) – Osadhi Virochana Jul 07 '22 at 06:44

0 Answers0