在硒中单击警报确定

时间:2019-04-02 08:49:19

标签: java selenium-webdriver

我希望在模式警报中单击“确定”按钮,但无法单击它。

<button type="button" class="close" ng-click="goTOLogin()">...</button>

尝试过此代码,但无法正常工作。这就是我在控制台中得到的内容

  

:未知错误:元素<div class="loader" style="display: block; opacity: 0.681626;"></div>在点(897,161)不可单击。其他元素将获得点击:<div id="registration" class="modal fade ng-scope in" role="dialog" style="display: block;"> <div class="modal-dialog modal-md add-brand"> <!-- Modal content--> <div class="modal-content flat-modal"> <div class="modal-header"> <button type="button" class="close" ng-click="goTOLogin()">X</button> <h4 class="modal-title common-title" style="" xpath="1">successfully registered</h4> </div> <div class="modal-body flat-body"> <div class="clearfix"></div> <h4>Woo Hoo! You have successfully registered! Look out for the activation link in your email.</h4> <div class="modal-footer text-left"> <button type="button" class="close" ng-click="goTOLogin()" style="">OK</button> </div> </div> </div> </div> </div>

这是html代码:

CREATE OR REPLACE FUNCTION union_all_tables()
 RETURNS TABLE
  (
    age   bigint
  ) AS
$$
DECLARE
 dynamic_query text = '';
 r_row         record;
BEGIN
FOR r_row IN SELECT table_schema || '.' || table_name qualified_table_name
       FROM information_schema.COLUMNS
       WHERE column_name = 'age' 
LOOP
dynamic_query := dynamic_query || format('UNION SELECT ' ||                                      
                                       'age ' ||
                                       'FROM %s ',r_row.qualified_table_name) || E'\n'; -- adding new line for pretty print, it    is not necessary
END LOOP;

dynamic_query := SUBSTRING(dynamic_query, 7) || ';';

RAISE NOTICE 'Union all tables in staging, executing statement: %',    dynamic_query;
RETURN QUERY EXECUTE dynamic_query;
END;
$$
LANGUAGE plpgsql;

1 个答案:

答案 0 :(得分:0)

您可以按Enter键接受警报。

Robot robot=new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);