使用selenium webdriver选择日历按钮

时间:2016-09-08 12:25:54

标签: java selenium button primefaces calendar

我试图选择日历按钮。这是我的代码:

%run "c:\users\aar15\appdata\local\temp\tmpvzauzz.py"

Give a real number sqrt(2)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

c:\users\aar15\appdata\local\temp\tmpvzauzz.py in <module>()

      1 import math
      2 try:
----> 3     valor = float(input("Give a real number "))

      4     print("Your value given is: ", value)
      5 except ValueError:

C:\Users\aar15\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\site-packages\IPython\kernel\zmq\ipkernel.pyc in <lambda>(prompt)

C:\Users\aar15\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.6.1.3253.win-x86_64\lib\site-packages\IPython\kernel\zmq\ipkernel.pyc in <module>()

NameError: name 'sqrt' is not defined 

Primefaces Calendar with Button

Html code

2 个答案:

答案 0 :(得分:1)

实际上Selenium 不支持复合类使用By.className()定位元素,您应该尝试使用By.cssSelector(),如下所示: -

driver.findElement(By.cssSelector("button.ui-datepicker-trigger.ui-button[aria-label='Show Calendar']")).click();

答案 1 :(得分:-1)

function loadFlowchart() {
    var flowChartJson = $('#jsonOutput').val();

    var objFromJson = JSON.parse(flowChartJson);
    var node = objFromJson.node;
    $.each(node, function (index, element) {
        var id = element.id;
        var classes = element.class;
        var positionTop = element.position.top
        alert("Id of element parsed: " + id + "\nclass: " + classes 
        + "\npositionTop: " + positionTop);
    });
}

second calendar tag