cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot Click Date within Date-Picker Browser Element.

BenScholefield
Level 2

Hello,

I am trying to select from a date Picker window within Chrome. I previously tried writing the date in the field using both a write stage and Global Send Keys, however the digits are scrambled. 

I have devised multiple methods for selecting the correct date, the one I landed on being dynamically setting the Xpath attribute for the desired date. I know this works because I can highlight the desired date by using the "Select" Action within the navigate stage.

When I  try to use the "Click" action on the desired date, however, nothing happens...

 I have tried making it focus on the element before clicking, using the "Double Click" Action, changing the Element Type from "Table Item" to "Web Element". There is no Global Mouse click action available for this element.

What can I do from here? Any help would be greatly appreciated.

27554.png



------------------------------
Ben Scholefield
------------------------------
3 REPLIES 3

John__Carter
Staff
Staff

Calendars are a nightmare Ben, so try everything you can before resorting to spying the calendar elements. You can replicate a Global Click with a workaround - it's a bit of pain, but it works.

  • Spy the browser window and the inner 'web content' area using Win32
  • Create a Global Click page that activates the main window and clicks the inner area
  • Add a Bounds collection input to the page and use it to calculate the click coordinates
  • To click a web element, read its bounds and then make a reference to the new page, passing in the collection

Note that this method assumes the element is visible and not scrolled off page.

27549.png



------------------------------
John Carter
Blue Prism
------------------------------

@BenScholefield, almost ANY HTML element can always be clicked in this way, though might have to make use of ScrollTo as well (as John said, for those off the screen).

IF the page has iframes and your content lies in an iframe, you'll have to click relative to the iframe (not the main over-arching HTML body), otherwise you'll click in the wrong position.

UIA is good enough usually to capture the iframe.

re SendKeys and scrambled characters, I think there's a fix for that in later BP versions, but in any case, you can put an interval of about 0.3 seconds as the other parameter to Send Keys.

Using the clipboard and Ctrl-V is another hack - for those fields that allow paste.



------------------------------
Anton Hosang
RPA Developer
Smart Automation Services
Europe/London
------------------------------

Dan.Lister
Level 4

Have you tried changing the format of the date you are writing to the field? We had a date field that needed the date formatting as yyyy/MM/dd before writing and it would then flip it to dd/MM/yyyy and accept it. Try reading the date field and see what format it comes out in, it may not be the same as is displayed.



------------------------------
Dan Lister
Developer
Arvato
Europe/London
------------------------------