Using {click} to use "Create an Event" button in Gmail calendar sidebar?

Now that {click} works across frames (YAYY!!!) I want to figure out how to use TextBlaze to send an email with Gmail and then with Gmail's Google Calendar sidebar click the "Create an Event" button so that when I send a customer an appointment confirmation email I can use the same Snippet to populate the appointment into my calendar. So far I've been able to make this work with a specific email message but because the clickable element string (here's an example: {click: frame=top; selector=#I0_1753292538263 |> .IKYMIb .mUIrbf-RLmnJb} ) changes from email to email it's not able to be used across the board. I did notice the selection always contains a class name that contains the string ".mUIrbf-" so maybe there is an expression that sort of works like a wildcard that can help here? If you all have any ideas on how to pull this off in Gmail you'd be helping me a ton. Ideally it would be a universally usable {click} string that manages to hit that button from any gmail account but am open to any creative ideas or workarounds.

Hi Joe,

You probably want to use an XPath selector instead of a CSS selector in this case.

XPath is a lot less commonly used than CSS and we don't have an auto-builder for it, but it has one very useful superpower which is being able to match based on text content.

Something like this might work in your case:

{click: xpath=//iframe[@title="Calendar"] |> //button[contains(string(.), 'Create an event')]}

You can learn more about XPath here:

1 Like

I've been chasing this one for over a year! Really appreciate you. I'm excited to learn more about XPath as this could be a game changer in my snippets for some of the more dynamic webforms

1 Like

One the same topic is there a way that you can think of for me to identify whether the Calendar sidebar frame is open in Gmail with a catch function in a snippet? Essentially what I'd like to do is have the snippet identify if that frame is open and if not I can have it click the icon to open it so my appointment can be successfully entered.

Hey @Joe_P - let us look into it and get back to you shortly.

Hi Joe, we would use something like this:

{if: catch({site: selector=[role=tabpanel]:not([style*=none]) iframe[title="Calendar"]}, "NONE") = "NONE"} {click: selector=div[role=tab][aria-label="Calendar"]}{wait: delay=0.5s}{endif}{click: xpath=//iframe[@title="Calendar"] |> //button[contains(string(.), 'Create an event')]}

The {site} command checks for the existence of a visible Calendar iframe. If it's missing, as checked by the catch() function, it emulates a click on the Calendar button to open the Calendar frame.

Although, on my end - the click on the Calendar button is not working. I will look into this later and get back to you with any updates. It looks like the button is not being focused in the first place.

1 Like

Yes if you can solve the calendar button not clicking that would be amazing. Thanks to all of you for your hard work on this fantastic tool. Keep me posted.

1 Like