首页 \ 问答 \ 如何解释运算符关联性?(How to interpret the operator associativity?)

如何解释运算符关联性?(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 from skb, 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
更新时间:2024-01-25 21:01

最满意答案

您的代码需要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 ...
  • 您的代码需要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 ...
  • 我得到了最简单的解决方案。 使用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 ...
  • 取决于你想做什么: 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 ...
  • 你可以阅读原始设备,我没有试过这个,但这篇博文看起来很有希望: http : //www.thelinuxdaily.com/2010/05/grab-raw-keyboard-input-from-event-device-node- devinputevent / 所以基本上你直接从/ dev / input / *阅读 您可以通过运行sudo cat /dev/input/eventX来验证这是否有效,其中X是该目录中列出的事件设备之一(其中一个将是您的键盘..我确信有一种很好的方法可以找到哪一个以编 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)