运行代码时,Firefox浏览器无法打开:
Traceback (most recent call last):
File "code.py", line 91, in <module>
Main()
File "code.py", line 74, in Main
browser = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 144, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
显示错误:
{{1}}
帮助..
答案 0 :(得分:0)
您必须设置driver = webdriver.Firefox(executable_path=r'YourPathTo/geckodriver')
:
chmod +x geckodriver
确保您的geckodriver可执行:
Dim dt As New DataTable
Dim r As DataRow
sub new()
dt.Columns.Add("a", Type.GetType("System.String"))
dt.Columns.Add("b", Type.GetType("System.String"))
dt.Columns.Add("c", Type.GetType("System.String"))
dt.Columns.Add("d", Type.GetType("System.String"))
end sub
Private Sub Grid1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvCarAccidentInjury.CellContentClick
If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then Exit Sub
Dim col = dgvCarAccidentInjury.Columns(e.ColumnIndex)
Dim row = dgvCarAccidentInjury.Rows(e.RowIndex)
If col.Name = "name_of_dgvcolumn_checkbox" Then
Dim chkCell = DirectCast(row.Cells("name_of_dgvcolumn_checkbox"), DataGridViewCheckBoxCell)
dr.rows.clear()
For i = 0 To dgvCarAccidentInjury.Rows.Count - 1
if chkCell then
r = dt.NewRow
r("a") = dgvCarAccidentInjury.Item(0, i).Value.ToString
r("b") = dgvCarAccidentInjury.Item(1, i).Value.ToString
r("c") = dgvCarAccidentInjury.Item(2, i).Value.ToString
r("d") = dgvCarAccidentInjury.Item(3, i).Value.ToString
dt.Rows.Add(r)
end if
Next
End If
End Sub