Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium已转换为Powershell_Python_Powershell - Fatal编程技术网

Python Selenium已转换为Powershell

Python Selenium已转换为Powershell,python,powershell,Python,Powershell,期待着写一个工作到我们的网站之一,并自动填充提交页面脚本。我在下面用python创建了它,但我希望避免将任何额外的东西下载到我们的服务器上(例如python)。想知道powershell中是否有类似selenium for python的库。有没有办法像在chrome中一样在IE中找到按钮的xpath或名称 下面的Python脚本: 您可以加载.NET库,请参阅:作为powershell的新手,我不太确定DLL是什么。如何找到元素?通过ID还是xpath?老实说,我认为在PowerShell中这

期待着写一个工作到我们的网站之一,并自动填充提交页面脚本。我在下面用python创建了它,但我希望避免将任何额外的东西下载到我们的服务器上(例如python)。想知道powershell中是否有类似selenium for python的库。有没有办法像在chrome中一样在IE中找到按钮的xpath或名称

下面的Python脚本:


您可以加载.NET库,请参阅:作为powershell的新手,我不太确定DLL是什么。如何找到元素?通过ID还是xpath?老实说,我认为在PowerShell中这样做会有点过头。我会正确地设置服务器(python+selenium模块),并使用类似jenkins的构建来启动、下载和运行最新版本的测试。或者,您可以在PowerShell中执行这些操作,并使用PowerShell remote运行测试。NET DLL是一个包含资源和源代码的归档文件,这些资源和源代码被传输到IL(如果我的记忆正确,则为中间语言)。
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!