我试图从所有正在运行的IE实例中获取一些数据,从页面源中钩住登录的用户名,我尝试使用selenium让用户从selenium运行IE,然后当用户登录时,我得到用户名,它只在第一个选项卡中工作,如果用户从另一个窗口/选项卡进入登录页面,我就无法捕捉到。看起来带有IE窗口手柄的selenium不能很好地工作。 在google上搜索,我可能找到了一个更好的东西,可以从所有运行的标签/窗口中的股票internetexplorer中获取一些数据。 在this link之后,我获得了页面标题和位置URL,它还解释了如何使页面导航到另一个URL。 现在我找不到的是如何获得页面源。在
from win32com.client import Dispatch
from win32gui import GetClassName
ShellWindowsCLSID = '{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'
ShellWindows = Dispatch ( ShellWindowsCLSID )
for sw in ShellWindows :
if GetClassName ( sw . HWND ) == 'IEFrame' :
print(sw)
print(sw.LocationName)
print(sw.LocationURL)
#sw.Document.Location = "http://python.org" navigating to another url
print(50 * '-')
我从this link找到了一个解决方案,所以基本上就是获取页面源代码
正在分析文件国际电工委员会您可以看到您可以设置输入值或单击按钮等
相关问题 更多 >
编程相关推荐