如何解释运算符关联性?(How to interpret the operator associativity?)
括号和指针符号具有相同的优先级,它们从左到右处理。 为什么以下代码尝试从
skb
获取成员nfct
,然后进行类型转换? 结果似乎从右到左。(struct nf_conn *) skb->nfct
Parentheses and pointer symbol have same priority, and they are dealed from left to right. Why does the following code try to get the member
nfct
fromskb
, then do the type conversion? It's seems that the associativity is from right to left.(struct nf_conn *) skb->nfct
原文:https://stackoverflow.com/questions/47152941
最满意答案
您的代码需要2个小的更改。
变化1:
WebElement loc=driver.findElement(By.className("input1"));
指向页面上的三个Web元素,而不是在下面使用
WebElement loc=driver.findElement(By.xpath("//input[@class='input1' and @name='pin_no']"));
改变2:它是一个文本字段,所以代替
a.moveToElement(loc)
使用
a.click(loc)
所以您的代码应如下所示:
public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver.get("http://fleet.idrivesafely.com"); driver.manage().window().maximize(); driver.findElement(By.linkText("Student Login")).click(); WebElement loc=driver.findElement(By.xpath("//input[@class='input1' and @name='pin_no']")); Actions a= new Actions(driver); a.click(loc).keyDown(Keys.SHIFT).sendKeys("wel").keyUp(Keys.SHIFT).sendKeys("co").keyDown(Keys.SHIFT).sendKeys("me").perform();
Your code requires 2 small changes.
Change 1:
WebElement loc=driver.findElement(By.className("input1"));
is pointing to three Web-elements on the page, Instead use below
WebElement loc=driver.findElement(By.xpath("//input[@class='input1' and @name='pin_no']"));
Change 2: Its a Text field, so Instead of
a.moveToElement(loc)
Use
a.click(loc)
So you code should be as below :
public static void main(String[] args) { WebDriver driver=new FirefoxDriver(); driver.get("http://fleet.idrivesafely.com"); driver.manage().window().maximize(); driver.findElement(By.linkText("Student Login")).click(); WebElement loc=driver.findElement(By.xpath("//input[@class='input1' and @name='pin_no']")); Actions a= new Actions(driver); a.click(loc).keyDown(Keys.SHIFT).sendKeys("wel").keyUp(Keys.SHIFT).sendKeys("co").keyDown(Keys.SHIFT).sendKeys("me").perform();
相关问答
更多-
我建议使用一个回退机制,首先从MDN处理建议,然后再回到旧解决方案。 但是如果你使用jQuery,你应该使用提供的方法来获取密钥代码 // jquery $(document.body).on('keyup', function(e) { delete keys[e.which]; }); // vanilla document.body.addEventListener('keyup', function (e) { delete keys[(e.key && e.keyCode.cha ...
-
所以我想出了一个解决方法stdin的限制,以使这个工作。 基本上我使用SDL库(及其节点绑定 )在后台运行一个程序,该程序在键盘上进行监听以进行输入。 去做这个: 确保您运行的是Node版本~0.10。 (显然,节点上的C绑定在0.11中的工作方式有点不同?) 通过自制软件安装sdl , sdl_ttf和sdl_image (在mac上) npm install --save https://github.com/creationix/node-sdl/tarball/master 然后是: var sdl ...
-
无法使用selenium Webdriver使用keyDown和keyUp事件(Unable to use keyDown and keyUp events using selenium Webdriver)[2021-10-11]
您的代码需要2个小的更改。 变化1: WebElement loc=driver.findElement(By.className("input1")); 指向页面上的三个Web元素,而不是在下面使用 WebElement loc=driver.findElement(By.xpath("//input[@class='input1' and @name='pin_no']")); 改变2:它是一个文本字段,所以代替 a.moveToElement(loc) 使用 a.click(loc) 所以您的 ... -
发生这种情况是因为使用MVVM和命令导航后 - UI线程被阻止。 并且,如果我使用调度程序进行导航,那么问题就解决了。 public void NavigateTo
(object parameter) { if (_rootFrame != null) { CoreDispatcher dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; ... -
这可能是非常明显的,但由于您在原始文章中没有提及它,并且您只是下载了驱动程序并且您的内部玩具应用程序正在运行,您是否已经在IEDriver代码页中提到了IE中的安全设置: 在Windows Vista或Windows 7上的IE 7或更高版本上,必须将每个区域的保护模式设置设置为相同的值。 该值可以打开或关闭,只要每个区域的值相同即可。 要设置保护模式设置,请从工具菜单中选择“Internet选项...”,然后单击安全选项卡。 对于每个区域,在标签为“启用保护模式”的选项卡底部会出现一个复选框。 如果您之前 ...
-
keyDown操作仅适用于修饰键: key.CONTROL key.SHIFT key.ALT key.COMMAND 要发送Tab键,请使用.sendKeys : var key = require('selenium-webdriver').Key; var actionSequence = require('selenium-webdriver').ActionSequence; new actionSequence(driver).keyDown(key.CONTROL).sendKeys(ke ...
-
当同时使用时,避免在keyup,keydown上发生多个事件(Avoid multiple events on keyup, keydown when used simultaneously)[2024-05-18]
我得到了最简单的解决方案。 使用event.type属性。 if(event.which == 13 && event.type == 'keyup') { // Do some stuff. You can use event.type = 'keydown' also } I got the most easiest solution. Use event.type property. if(event.which == 13 && event.type == 'keyup') { // D ... -
我们应该如何处理WPF中的键盘事件?(How should we handle keyboard events in WPF? Should it be KeyUp or KeyDown?)[2023-07-14]
取决于你想做什么: PreviewKeyDown =在按下键之前 示例:如果在文本框上有事件,则按下的当前键不会添加到TextBox.Text PreviewKeyUp =放开密钥之前 KeyDown =按下键后 示例:如果在文本框上有事件,则按下的当前键将添加到TextBox.Text KeyUp =放开钥匙后 所以这又取决于你想做什么。 如果要添加TextBox验证,请使用PreviewKeyDown忽略文本(如果不正确)。 如果你想在用户放开SPACE时做某事,那么我们就是KeyUp Depends ... -
这是我的建议: IWebDriver webDriver = new InternetExplorerDriver(); webDriver.Navigate().GoToUrl(@"C:\Users\us\Documents\Visual Studio 2012\Projects\SeleniumTests\SeleniumTests\test.html"); var el = webDriver.FindElement(By.XPath(".//*[@id ...
-
检测Linux C ++上的keydown和keyup事件[重复](Detecting keydown and keyup events on Linux C++ [duplicate])[2022-03-01]
你可以阅读原始设备,我没有试过这个,但这篇博文看起来很有希望: http : //www.thelinuxdaily.com/2010/05/grab-raw-keyboard-input-from-event-device-node- devinputevent / 所以基本上你直接从/ dev / input / *阅读 您可以通过运行sudo cat /dev/input/eventX来验证这是否有效,其中X是该目录中列出的事件设备之一(其中一个将是您的键盘..我确信有一种很好的方法可以找到哪一个以编 ...