第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Selenium IDE python 代碼導出,不起作用

Selenium IDE python 代碼導出,不起作用

富國滬深 2023-05-09 15:31:50
我想使用 Selenium IDE 在 Chrome 中完成一些簡單的任務,然后將代碼導出到 python 并在那里執(zhí)行。但是,當我在 python 中執(zhí)行導出的代碼時,什么也沒有發(fā)生。# Generated by Selenium IDEimport pytestimport timeimport jsonfrom selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.common.action_chains import ActionChainsfrom selenium.webdriver.support import expected_conditionsfrom selenium.webdriver.support.wait import WebDriverWaitfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesclass TestIDETest():   def setup_method(self, method):    self.driver = webdriver.Chrome('C:/Users/Jakob/Documents/Python-Selenium/chromedriver.exe')    self.vars = {}    def teardown_method(self, method):    self.driver.quit()        def test_iDETest(self):    self.driver.get("https://www.google.de/")    self.driver.set_window_size(1050, 660)    self.driver.find_element(By.NAME, "q").send_keys("wikipedia")    self.driver.find_element(By.NAME, "q").send_keys(Keys.ENTER)    self.driver.find_element(By.CSS_SELECTOR, ".rc:nth-child(3) .LC20lb").click()    self.driver.find_element(By.ID, "txtSearch").click()    self.driver.find_element(By.ID, "txtSearch").send_keys("delta")    self.driver.find_element(By.ID, "txtSearch").send_keys(Keys.ENTER)    self.driver.find_element(By.LINK_TEXT, "English").click()    element = self.driver.find_element(By.CSS_SELECTOR, ".mw-wiki-logo")    actions = ActionChains(self.driver)    actions.move_to_element(element).perform()    element = self.driver.find_element(By.CSS_SELECTOR, "body")    actions = ActionChains(self.driver)    actions.move_to_element(element, 0, 0).perform()    element = self.driver.find_element(By.CSS_SELECTOR, "#ca-talk > a")    actions = ActionChains(self.driver)    actions.move_to_element(element).perform()    self.driver.close()當我刪除類和方法并只執(zhí)行它工作的“原始”代碼時。所以我不確定如何使用這些方法。提前致謝。
查看完整描述

1 回答

?
斯蒂芬大帝

TA貢獻1827條經(jīng)驗 獲得超8個贊

如果你想讓它按原樣運行,你需要實例化類并啟動里面的函數(shù)。在腳本末尾添加:


testClass = TestIDETest()


testClass.setup_method("")

testClass.test_iDETest()

testClass.teardown_method("")

我之前沒有從 IDE 中導出過,所以我無法評論它想要的“方法”變量的用途(而且它似乎沒有對它做任何事情)——但它是空白的。

查看完整回答
反對 回復 2023-05-09
  • 1 回答
  • 0 關注
  • 441 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號