国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術(shù)文章
文章詳情頁

python - 出錯:Unresolved reference ’selenium’是什么原因

瀏覽:139日期:2022-08-14 14:27:23

問題描述

# -*- coding: utf-8 -*-from selenium import seleniumimport unittest, time, reclass rc(unittest.TestCase): def setUp(self):self.verificationErrors = []self.selenium = selenium('localhost', 4444, '*chrome', 'https://www.baidu.com/')self.selenium.start()def test_rc(self):sel = self.seleniumsel.open('/')sel.type('id=kw', 'selenium')sel.click('id=container')sel.click('id=su')def tearDown(self):self.selenium.stop()self.assertEqual([], self.verificationErrors)if __name__ == '__main__': unittest.main()

這是用selenium ide 錄的,轉(zhuǎn)成 selenium remote control代碼

在ide測試是通過的。

但在pycharm里打開,第一行from selenium import selenium

就會出錯:Unresolved reference ’selenium’

這是什么原因?

======================================

(我的環(huán)境是python3.5

selenium3.3.1

selenium-server-standalone-3.3.1.jar)

問題解答

回答1:

打開Pycharm設(shè)置搜索Project Interpreter查看是否有對應(yīng)的包,以及Python版本是否和你的Python版本一致

確認(rèn)你的selenium在PYTHONPATH中

添加selenium到你的PYTHONPATH中 or Pycharm依賴中

回答2:

這個問題是由于你的電腦安裝了多個Python ,解決方法請參考。

https://zhuanlan.zhihu.com/p/...

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 文水县| 宁陕县| 翁牛特旗| 新晃| 宁武县| 诸城市| 遂川县| 锡林郭勒盟| 巴林左旗| 额尔古纳市| 海安县| 通许县| 江西省| 新乡县| 九龙县| 新干县| 谷城县| 芮城县| 东宁县| 广州市| 绥德县| 兴文县| 深水埗区| 濮阳市| 黔西县| 雷山县| 黔西县| 诸暨市| 无锡市| 元氏县| 广河县| 武山县| 乾安县| 沙田区| 安塞县| 静安区| 离岛区| 莎车县| 株洲市| 安多县| 锦州市|