AttributeError: partially initialized module ‘selenium.webdriver‘ has no attribute ‘Chrome‘

Python创建selenium项目报错 

AttributeError: partially initialized module 'selenium.webdriver' has no attribute 'Chrome' (most likely due to a circular import)

自查:浏览器驱动位置正确

猜想原因可能是我文件名称select.py跟导入的Select模块名称重复了,于是修改文件名,再运行就正常了。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
amazon 4星评分 A practical guide on automated web testing with Selenium using Python About This Book Write and automate tests for your applications with Selenium Explore the Selenium WebDriver API for easy implementations of small to complex operations on browsers and web applications Packed with easy and practical examples that get you started with Selenium WebDriver Who This Book Is For If you are a quality testing professional, or a software or web application developer looking to create automation test scripts for your web applications, with an interest in Python, then this is the perfect guide for you. Python developers who need to do Selenium testing need not learn Java, as they can directly use Selenium for testing with this book. What You Will Learn Create Selenium WebDriver tests using the Python unittest module Use Selenium WebDriver for cross-browser testing Build reliable and robust tests using implicit and explicit waits Set up and use Selenium Grid for distributed run Test web applications on mobile platforms such as iOS and Android using Appium Utilize various methods provided by Selenium WebDriver to locate web elements and interact with them Capture screenshots and videos of the test execution In Detail Selenium WebDriver is a popular automated testing tool for web applications. Python is one of the top programming languages and when used with Selenium it can automate and test web applications. Using Python's unittest module, you can write test cases in Selenium. Over the years, Selenium has become a very powerful testing platform and many organizations are adopting Selenium WebDriver for creating automated user interface tests. The book's main aim is to cover the fundamentals related to Python Selenium testing. You will learn how the Selenium WebDriver Python API can be integrated with CI and Build tools to allow tests to be run while building applications. This book will guide you through using the Selen
AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'错误是由于selenium库中的webdriver模块没有Chrome属性引起的。这个错误通常发生在使用过时的代码或版本过低的selenium库时。为了解决这个问题,你需要确保你安装的selenium库是最新版本,并且使用正确的方法来实例化Chrome浏览器对象。 首先,确保你的selenium库是最新版。你可以通过在命令行中运行以下命令来更新selenium库: ``` pip install --upgrade selenium ``` 然后,你可以尝试使用以下代码来实例化Chrome浏览器对象: ``` from selenium import webdriver browser = webdriver.Chrome() ``` 这里使用的是webdriver模块中的Chrome属性来实例化Chrome浏览器对象。确保你已经正确安装了Chrome浏览器以及Chrome驱动程序,并将Chrome驱动程序的路径添加到系统环境变量中。 如果你仍然遇到相同的错误,请确保你的代码中没有其他地方导入了selenium.webdriver模块并覆盖了webdriver属性,或者查看你的代码中是否存在其他潜在的错误。 总结起来,要解决AttributeError: module 'selenium.webdriver' has no attribute 'Chrome'错误,你需要确保你的selenium库是最新版本,并使用正确的方法实例化Chrome浏览器对象。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [已解决(最新版selenium报错)AttributeError: moduleselenium.webdriver‘ has no attribute ...](https://blog.csdn.net/yuan2019035055/article/details/125830305)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值