-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
大佬春节好,我感觉复杂点的窗体定位控件很慢! #33
Comments
Hi @xinchenll 新年快乐!感谢关注! 让我拆分一下问题:
|
你好大佬,有个方式通过xpath查找元素driver.find_element_by_xpath(),但是在仔细观察开放文档和API发现并没有获取xpath的方式,不知道是没有还是我的使用方式有问题呢 |
@suqi95716aa 你好, xpath 的查找形式并不存在于JAB API 中,属于 pyjab 自定义的查找方式,用于定位较为复杂的控件
|
@xinchenll 你好, 推荐您使用这样的方式进行定位查找控件,可能会快一些 |
是的,我看到了这样根据xpath找到元素的方式,但是我这边有一个需求,比如通过坐标位置获取这个坐标位置下的元素控件,并获取一些关于这个控件的属性。比如parent、xpath、classname、name等信息,不知道有没有相关的API呢 |
@suqi95716aa |
@gaozhao1989 |
pyjab.zip
|
Thanks for your contribution, very nice idea for get specific level child Element from node tree.
|
Reopen the issue |
@discovery-131794 Thanks for ur giving. I will try to integrate ur change into my project and do some other change, at that time, I will contribute my code here. |
Hi @discovery-131794 , |
Hi @szczepanR , |
driver.find_element_by_xpath(
"//root pane/layered pane/panel[@indexinparent=0]/panel[@indexinparent=0]/panel[@indexinparent=1]/panel[@indexinparent=1]/push button[@indexinparent=6]"
以为这样把所有路径都指定好,会快一些,谁知道并没有任何改善,还是需要约40秒才能成功定位,期间我观察这段时间的cpu利用率真,会上升一些,但是cpu还是很空闲,于是我想用多线程的方法提高CPU利用率,大慨是下面的方法:
from multiprocessing import Process
p = Process(target=, args=("bt",))
ps_list = []
for i in range(0, cpu_logical_count):
ps_list.append(Process(target=driver.find_element_by_xpath, args=(xpath,))
for p in ps_list:
p.start()
for p in ps_list:
p.join()
发现这样不行,会报错,现在也没什么好的办法了,不知道你那有什么好的建议没有?
The text was updated successfully, but these errors were encountered: