如何解决VBA Selenium没有将数据的第一列返回到Excel
我已经安装了Selenium,所有功能都可以正常工作,只是没有从站点返回并在Excel中发布第一列数据。我敢肯定这很简单。任何人,请帮助。
df2 = (df.set_index('ID')[['Manager1','Manager2','Manager3']]
.stack()
.reset_index(level=1,drop=True)
.reset_index(name='Manager'))
print (df2)
ID Manager
0 1 S394[1]
1 1 G490[2]
2 1 3004[3]
3 2 3905[1]
4 2 4003[2]
5 2 5003[3]
解决方法
我没有Selenium,但这是使用IE自动化的基本轮廓:
Dim Explorer As Object,doc,tbls,tr,td
Set Explorer = GetIEByUrl("https://www.cmegroup.com/trading*") 'function to get an open window by URL
Set doc = Explorer.document
Set tbls = doc.getElementsByTagName("table")
'look at the first table: get the rows in the table body
For Each tr In tbls(0).getElementsByTagName("tbody") (0).getElementsByTagName("tr")
'the first cell is a th
Debug.Print tr.getElementsByTagName("th")(0).innerText
'the rest of the cells are td's
For Each td In tr.getElementsByTagName("td")
Debug.Print td.innerText
Next td
Debug.Print "***********************"
Next tr
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。