Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python程序的Tkinter按钮中使用Selenium函数_Python_Python 3.x_Selenium_Selenium Webdriver_Tkinter - Fatal编程技术网

在Python程序的Tkinter按钮中使用Selenium函数

在Python程序的Tkinter按钮中使用Selenium函数,python,python-3.x,selenium,selenium-webdriver,tkinter,Python,Python 3.x,Selenium,Selenium Webdriver,Tkinter,我们可以在Tkinter按钮中使用selenium函数吗?因此,当我单击按钮时,它将执行Selenium功能。类似地,为selenium中执行的其他步骤创建更多的按钮。您可以执行以下操作- def myTask(): #Your selenium code Here #You can use loop and pandas to iterate over Excel b = Button(root,textvariable=button_text, text="C

我们可以在Tkinter按钮中使用selenium函数吗?因此,当我单击按钮时,它将执行Selenium功能。类似地,为selenium中执行的其他步骤创建更多的按钮。

您可以执行以下操作-

def myTask():
    #Your selenium code Here
    #You can use loop and pandas to iterate over Excel



b = Button(root,textvariable=button_text, text="Click me", font="lucida 8 bold", padx=8, pady=8,width="20", command=myTask)
button_text.set("Selenium Method")
b.place(relx=.46, rely=.7, anchor=CENTER)

你可以加上。你能详细说明你的问题吗?你想用哪种硒方法?我正在用硒打开一个网站,然后从我的excel表格中登录并填充不同的单元格。然后从excel到该网站重复此过程。每次操作后,请求许可在循环中执行下一步。到目前为止,您尝试了什么?在selenium中,我可以运行程序,但在tkinter中无法运行该程序,因为按钮单击谢谢@vishav将尝试此名称错误:未定义名称“button\u text”,因此出现此错误now@DipankarGogoi首先将其声明为button_text=StringVar()和导入库。希望它能成功。谢谢你,维沙夫。我没有定义它,所以它不起作用当我尝试使用selenium driver调用另一个按钮中的活动窗口时,还有一个问题要问@vishav,单击它不起作用。它说驱动程序没有定义。这个问题有什么解决办法吗。这样我就可以使用驱动程序从上一个按钮打开的窗口单击来执行其他功能