试图单击WebPage中的“内部”选项卡,但代码不起作用

时间:2017-02-17 04:22:23

标签: java selenium automation css-selectors qa

在点击网页内的选项卡时,代码无效,甚至在执行代码时也没有出现任何错误。 我写的代码单击选项卡[ 分类 ]



FileLoadException: Could not load file or assembly 'System.Core, 
Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of 
its dependencies. The located assembly's manifest definition does not match 
the assembly reference. (Exception from HRESULT: 0x80131040)
    at ZXing.BarcodeReader..ctor()
    at HelloWorldV2.Start()






WebElement tabCategory = driver.findElement(By.xpath("//dd[2]//a[@class='btn f1']"));
tabCategory.click()




我要点击的标签图片如下所示 enter image description here

1 个答案:

答案 0 :(得分:0)

请尝试以下任何一项xpath

//a[text()= 'Categorization']/following::a
  

OR

//span[@class='TabRight']/..//preceding-sibling::a[text()= 'Categorization']/following::a