无法在Visual Studio代码中运行Selenium IDE Python代码

问题描述

将记录的Selenium IDE测试导出到.py文件,然后在Visual Studio Code中打开它后,运行该文件似乎没有任何反应。

终端中唯一显示的是: “ PS C:\ Users \ User>和python c:/Users/User/Desktop/test1.py”

代码如下:

# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class test1():
  def setup_method(self,method):
    self.driver = webdriver.Chrome()
    self.vars = {}

  def teardown_method(self,method):
    self.driver.quit()

  def test1(self):
    self.driver.get("http://192.168.5.1/")
    self.driver.set_window_size(1123,824)
    self.driver.switch_to.frame(1)
    self.driver.find_element(By.NAME,"f_username").click()
    self.driver.find_element(By.NAME,"f_username").send_keys("Administrator")
    self.driver.find_element(By.NAME,"pwd").send_keys("Administrator")
    self.driver.find_element(By.CSS_SELECTOR,".submitBtn").click()

关于Visual Code为什么不显示任何特定错误而只写以下内容的任何想法:“ PS C:\ Users \ User>和python c:/Users/User/Desktop/test1.py”?

我猜它缺少开始执行代码的行,我该怎么做?

非常感谢, 托马斯

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...