有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!


共 (3) 个答案

  1. # 1 楼答案

    使用绝对xpath,只需使用firebug标识该日期选择器的日期,右键单击获取xpath,然后使用该xpath选择该元素

  2. # 2 楼答案

    试试这个

    单击加入日期字段,然后单击所需日期,如

    driver.findElement(By.<Joining Date field>).click();
    driver.findElement(By.linkText(<Date>)).click();
    

    例:

    driver.findElement(By.id("calendarSelect")).click();
    driver.findElement(By.linkText("6")).click();
    
  3. # 3 楼答案

    试试这个,它永远不会失败

    “试试{

        WebElement dateWidget = driver.findElement(By.xpath(OR.getProperty(object)));
    
        List<WebElement> rows = dateWidget.findElements(By.tagName("tr"));  
        List<WebElement> columns = dateWidget.findElements(By.tagName("td"));  
    
        for (WebElement cell: columns){
            if (cell.getText().equals(data)){
                cell.findElement(By.linkText(data)).click();
                break; 
            }
        }
    }catch(Exception e){
        return Constants.KEYWORD_FAIL+"   Not able to select the date"+e.getMessage();
    }`