使用css-selector定位网页元素,同样的css选择器代码,在chrome浏览器中可以正常定位到元素,但是在IE浏览器中,只能定位到html元素。
代码如下:
import ...略
dim ...略
# 打开网页
hWeb = WebBrowser.Create("ie","https://forum.uibot.com.cn/",10000,{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200,"sBrowserPath":"","sStartArgs":""})
#icon("@res:6in1a2la-mp54-8kmr-fcc8-7bchh253r3pj.png")
arrElement = UiElement.GetChildren(\
{"wnd":[{"cls":"IEFrame","title":"*","app":"iexplore"},{"cls":"Internet Explorer_Server"}],
"html":{"url":"https://forum.uibot.com.cn/","title":"UiBot 开发者社区","tagName":"UL","attrMap":{"css-selector":"ul.list-unstyled"},"index":1}},
{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
For Each ele In arrElement
TracePrint(ele)
Next
是因为uibot现在对IE中使用css-selector的兼容性不太好吗?主研团队有没有对该方面进行增强的打算?