0

I have a page which has a bootstrap DateTime picker like this:

enter image description here

I can click the calendar icon to show the popup. Also, the popup becomes display: block; from display: none;

But when I click 今日 button,I got an error:

selenium.common.exceptions.ElementNotVisibleException: Message: element not visible

But as you see the element is actually visible now.

My element selector is right, because I can log the element use:

eml = browser.find_element_by_class_name('today')
print eml.get_attribute('innerHTML')

It shows 今日

How can I click this element?

Chirag Patel
  • 373
  • 5
  • 20
fish
  • 2,173
  • 2
  • 13
  • 18
  • do you really need click on the calendar? because if you need just introduce a data you can select the previous checkbox and do a command send_keys("your_data") – Carlo 1585 Sep 29 '17 at 10:00
  • the calendar can't support send keys, because it can only choose by click – fish Oct 02 '17 at 04:38

1 Answers1

0

Could you please try with action classes.

 Actions actions= new Actions(driver); // heare you state ActionBuider
actions.moveToElement(eml); // Here you perform hover mouse over the needed elemnt to triger the visibility of the hidden
actions.click().build().perform();

I think this should work.Please let me know if it doesn't work

  • I add code like this `webdriver.ActionChains(browser).move_to_element(eml).click(eml).perform()`, it have no error log, but it isn't click that element, I don't know why – fish Oct 02 '17 at 04:40
  • Can you please paste the html code for webelement here . Also can you please check whether it is an svg element or something like that – Aarya Hareendranath Oct 02 '17 at 12:41
  • Thanks for your answer! I have no source code of this page, I only know that it a bootstrap datatimepicker component, but I think it's not a svg element. – fish Oct 04 '17 at 01:16