public void clickDateDropDownButton() { SeleniumUtil.jsClick(driver, page.getDateDropdownButtonOfInvPolicyDialog()); WebElement dropDown = page.getDropdownListOfDateInInvPolicyDialog(); String oldStyle =dropDown.getAttribute("style"); logger.info("The old style is : " + oldStyle); String newStyle=""; if(oldStyle.contains("display")){ newStyle = oldStyle.split("display")[0]; } else{ newStyle = oldStyle+" display: none;"; } String javaScript = "return jQuery(arguments[0]).attr(‘style‘,‘"+newStyle+"‘);"; ((JavascriptExecutor) driver).executeScript(javaScript, dropDown); logger.info("The new style is : " + newStyle); }
时间: 2024-12-22 00:22:07