在Selenium中,我如何找到“当前”宾语 [英] In Selenium how do I find the "Current" object

查看:126
本文介绍了在Selenium中,我如何找到“当前”宾语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望Selenium通过箭头键导航菜单 - 点击顶部菜单项然后按DOWN,DOWN,...

I would like for Selenium to navigate a menu via arrow keys--Starting with clicking the top menu item then pressing "DOWN", "DOWN", ...

问题是你必须总是提供一个特定元素来发送DOWN。

The problem is that you have to always supply a specific element to send the "DOWN" to.

有没有办法获得当前元素?

Is there any way to get the current element?

我试过:

by.xpath(".")

但它表示该表达式无法识别或未返回正确的对象。

but it said that the expression was unrecognized or didn't return a proper object.

我希望我能错过一些愚蠢的伎俩。

I expect I'm jsut missing some stupid trick.

推荐答案

不知道一个比访问 document.activeElement

如何测试哪个元素在Selenium RC中具有焦点?

这篇关于在Selenium中,我如何找到“当前”宾语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆