0

Looking to write a script for work to go to one of our websites and auto populate a page for submission. I have created this below with python below but I would like to avoid downloading anything extra onto our servers (ie. Python). Wondering if there is a library in powershell like selenium for python. Is there a way to find the xpath or name of buttons in IE like you do in chrome?

Python script below:

import time
    from selenium import webdriver

    #Go to website Site
    driver = webdriver.Chrome("C:/WebDrivers/chromedriver.exe")  # Optional argument, if not specified will search path.
    driver.get('yourwebsite');
    time.sleep(2) # Let page load!

    #Log In with Credentials
    search_box = driver.find_element_by_name("txtUserName")
    search_box.send_keys('YourUsername')#Your Username
    search_box1 = driver.find_element_by_name("txtPassword")
    search_box1.send_keys('YourPassword')#Your Password
    submit_button = driver.find_element_by_name('btnLogin')
    submit_button.click()
    time.sleep(10) # Let page load!
Michael T Johnson
  • 679
  • 2
  • 13
  • 26
  • You can load .NET libraries, see: https://stackoverflow.com/questions/7972141/run-my-third-party-dll-file-with-powershell – Jonas Sep 05 '18 at 15:48
  • Being new to powershell Im not quite sure what DLL is. How do you find elements? by ID or xpath? – Michael T Johnson Sep 05 '18 at 17:00
  • Honestly, I think doing it in PowerShell would be an overkill. I would set up the server properly (python + selenium module) and use a build too such as jenkins to fire up, download and run the latest versions of the tests you have. Or you can do them in PowerShell and use PowerShell remote to run the tests. A .NET DLL is an archive containing resources and source code transpiled to IL (Intermediate Language if my memories are correct). – Jonas Sep 06 '18 at 20:18

0 Answers0