Selenium - Java:努力选择特定元素

时间:2016-10-21 08:47:29

标签: java selenium selenium-webdriver selenium-chromedriver

我目前正在为Web应用程序创建一些脚本。我目前只是选择了一个特定的按钮。我已经花了几个小时,但仍然没有运气。任何建议或指导将不胜感激。我已经添加了下面的源代码以及图像。

我目前的失败尝试:

chromeDriver.findElement(By.linkText("uploadfile")).click();
chromeDriver.findElement(By.xpath("html/body/div[9]/input")).click();
chromeDriver.findElement(By.xpath("//iput[@name='uploadfile']")).click

div style="display: block; position: absolute; overflow: hidden; margin: 0px; padding: 0px; opacity: 0; direction: ltr; z-index: 16777270; left: 835px; top: 313px; width: 232px; height: 46px; visibility: hidden;">
<input name="uploadfile" style="position: absolute; right: 0px; margin: 0px; padding: 0px; font-size: 480px; font-family: sans-serif; cursor: pointer; height: 100%; z-index: 16777270;" type="file">

enter image description here

1 个答案:

答案 0 :(得分:0)

使用此路径: -

  //input[@name='uploadfile' and @style='position: absolute; right: 0px; margin: 0px; padding: 0px; font-size: 480px; font-family: sans-serif; cursor: pointer; height: 100%; z-index: 16777270;']
相关问题