英文:
Selenium Python 3.7 script for toggling radio buttons and downloading citation information giving Google Chrome errors, any solutions?
问题
Good morning,
早上好,
I am looking to create a script using Selenium in order to toggle radio buttons, download information using citation.
我想要创建一个使用Selenium的脚本,以便切换单选按钮并使用引用下载信息。
The following steps are what I have taken:
1)Click the checkbox.
2)Click the export button
3)Open small window
4)Select citation and abstract information button in window
5)Click export
6)Download information
我已经执行了以下步骤:
- 点击复选框。
- 点击导出按钮
- 打开小窗口
- 在窗口中选择引用和摘要信息按钮
- 点击导出
- 下载信息
I have a selenium script, but I keep getting errors that have to do with the Google Chrome section. Does here have a similar problem? Thanks.
我有一个Selenium脚本,但我一直遇到与Google Chrome部分有关的错误。这里是否有类似的问题?谢谢。
Tried debugging Selenium script by looking up the google.chrome() issue. Could not find the solution.
尝试通过查找google.chrome()问题来调试Selenium脚本。未能找到解决方法。
#Update
#更新
Here is where I'm having the issue with, it's with the web.driver
这是我遇到问题的地方,问题出在web.driver上
from selenium import webdriver
# May have to use google chrome engine for this
# Checkbox setup
# Must specify the driver part where Chrome is
# Debug this immediately!
driver = webdriver.Chrome(executable_path=r"C:\Users\TheUsersName\.cache\selenium\chromedriver\win324.0.5735.90.chromedriver.exe")
# Specify the website to download information from
driver.get("https://ieeexplore.ieee.org/xpl/conhome/9811522/proceeding")
# Working with the radio buttons
# First, inspect the element by right-clicking inspect element (Developers Console)
# Click the checkbox button for citation
# This can be used to find multiple checkboxes at the same time, just repeat the code below
driver.find_element_by_id("ng-valid ng-dirty ng-touched").click() # First checkbox on the website
# To verify the selection, use the following code
status = driver.find_element_by_id("ng-valid ng-dirty ng-touched").is_selected()
# Will display if it's true or not
print(status)
问题出在web.driver,显然消息是以下内容:
WebDriver.init() got an unexpected keyword argument 'execeutable_path'
WebDriver.init()获得了一个意外的关键字参数'execeutable_path'
#Update
#更新
I have corrected the following code above with a new one, but I am getting the following error below with locating Chrome or using the Chrome Binary.
我已经使用新的代码纠正了上面的代码,但是我在查找Chrome或使用Chrome二进制文件时遇到了以下错误。
# Import modules
from selenium import webdriver
# Use pip install webdriver_manager to install this module below
from selenium.webdriver.chrome.options import Options
# May have to use google chrome engine for this. Confirmed
# Must specify the driver part where Chrome is. This is located in Documents
# ChromeOptions is an instance
options = webdriver.ChromeOptions()
# Debug this immediately!
options.binary_location = r"C:\Users\UserName\Documents\chromedriver.exe"
# Debug this immediately!
options = Options()
options.add_argument("--headless")
# setting the binary location of the Chrome Instance
driver = webdriver.Chrome(PATH=r"C:\Users\UsersName\Documents\chromedriver.exe")
# Maximize the window
# driver.maximize_window()
# Specify the website to download information from
driver.get('https://ieeexplore.ieee.org/xpl/conhome/9811522/proceeding')
# Checkbox setup
# First, inspect the element by right-clicking inspect element (Developers Console(F12))
# Then, right-click the element and click copy and then copy selector
# Click the checkbox button for citation
# This can be used to find multiple checkboxes at the same time, just repeat the code below
driver.find_element_by_id("ng-valid ng-dirty ng-touched").click() # First checkbox on the website
# To verify the selection, use the following code
status = webdriver.find_element_by_id("ng-valid ng-dirty ng-touched").is_selected()
# Will display if it's true or not
print(status)
What I'm trying to do is find the direct PATH where Selenium is located. However, when I do this, it comes out as it cannot find the Path or has a binary issue. Any suggestions?
我试图找到Selenium所在的直接路径。然而,当我这样做时,它显示找不到路径或存在二进制问题。有任何建议吗?
英文:
Good morning,
I am looking to create a script using Selenium in order to toggle radio buttons, download information using citation.
The following steps are what I have taken:
1)Click the checkbox.
2)Click the export button
3)Open small window
4)Select citation and abstract information button in window
5)Click export
6)Download information
I have a selenium script, but I keep getting errors that have to do with the Google Chrome section. Does here have a similar problem? Thanks.
Tried debugging Selenium script by looking up the google.chrome() issue. Could not find the solution.
#Update
Here is where i'm having the issue with, its with the web.driver
from selenium import webdriver
"""May have to use google chrome engine for this"""
#Checkbox setup
#Must specifiy the driver part where Chrome is
#Debug this immediately!
driver = webdriver.Chrome(execeutable_path = r"C:\Users\TheUsersName\.cache\selenium\chromedriver\win324.0.5735.90.chromedriver.exe")
#Specify the website to download information from
driver.get("https://ieeexplore.ieee.org/xpl/conhome/9811522/proceeding")
#Working with the radio buttons
#First, inspect the element by right-clicking inspect element(Developers Console)
#Click the checkbox button for citation
#This can be used to find multiple checkboxes at the same time, just repeat the code below
driver.find_element_by_id("ng-valid ng-dirty ng-touched").click()#First checkbox on the website
#To verify the selection, use the following code
status = driver.find_element_by_id("ng-valid ng-dirty ng-touched").is_selected()
#Will display if its true or not
print(status)
The issue i'm having is with the web.driver, apparently the message is the below:
WebDriver.init() got an unexpected keyword argument 'execeutable_path'
#Update
I have corrected the following code above with a new one, but I am getting the following error below with locating Chrome or using the Chrome Binary.
#Import modules
from selenium import webdriver
#Use pip install webdriver_manager to install this module below
from selenium.webdriver.chrome.options import Options
#from webdriver_manager.chrome import ChromeDriverManager
"""May have to use google chrome engine for this. Confirmed"""
#Must specifiy the driver part where Chrome is. This is located in Documents
#ChromeOptions is an instance
options = webdriver.ChromeOptions()
#Debug this immediately!
options.binary_location = r"C:\Users\UserName\Documents\chromedriver.exe"
#Debug this immediately!
options = Options()
options.add_argument("--headless")
#setting the binary location of the Chrome Instance
driver = webdriver.Chrome(PATH=r"C:\Users\UsersName\Documents\chromedriver.exe")
#Maximize the window
#driver.maximize_window()
#Specify the website to download information from
driver.get('https://ieeexplore.ieee.org/xpl/conhome/9811522/proceeding')
#Checkbox setup
#First, inspect the element by right-clicking inspect element(Developers Console(F12))
#Then, right-click the element and click copy and then copy selector
#Click the checkbox button for citation
#This can be used to find multiple checkboxes at the same time, just repeat the code below
driver.find_element_by_id("ng-valid ng-dirty ng-touched").click()#First checkbox on the website
#To verify the selection, use the following code
status = webdriver.find_element_by_id("ng-valid ng-dirty ng-touched").is_selected()
#Will display if its true or not
print(status)
What i'm trying to do is find the direct PATH where Selinumn is located. However, when I do this, it comes out as it cannot find the Path or has a binary issue. Any suggestions?
答案1
得分: 0
以下是翻译好的部分:
错误信息如下:
TypeError: WebDriver.__init__() got an unexpected keyword argument 'execeutable_path'
存在拼写错误,正确的是 executable_path
而不是 execeutable_path
。
应该这样写:
driver = webdriver.Chrome(executable_path=r"C:\Users\TheUsersName\.cache\selenium\chromedriver\win324.0.5735.90.chromedriver.exe")
英文:
As the error says,
TypeError: WebDriver.__init__() got an unexpected keyword argument 'execeutable_path'
There is a typo error as the correct one is executable_path
and not execeutable_path
.
This way:
driver = webdriver.Chrome(executable_path = r"C:\Users\TheUsersName\.cache\selenium\chromedriver\win324.0.5735.90.chromedriver.exe")
答案2
得分: 0
我已经找到了解决方案。excutable_path
不再是有效的方法,已经被延迟处理。相反,只需将其使用为r"TheBinaryLocation.exe"
将解决这个问题。
英文:
I have found the solution. excutable_path
is no longer a valid method and is deferred. Instead, just using it as r"TheBinaryLocation.exe"
will solve this problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论