I’m trying to use selenium to click a button in google translate (the From: button) but I’m having trouble doing so. My goal is to select a language from the drop-down menu.
This is, hopefully, the html code for the particular section that I want to click on
<div id="gt-sl-gms" class="goog-inline-block goog-flat-menu-button je" aria-expanded="false" role="listbox" style="-webkit-user-select: none;" tabindex="0" aria-haspopup="false" aria-activedescendant=""><div class="goog-inline-block goog-flat-menu-button-caption">From: English</div><div class="goog-inline-block goog-flat-menu-button-dropdown"></div></div>
Looking at this it looks like the id is gt-sl-gms so I think my selenium code should look like this
Open the Browser to google translate
Open Browser ${google_translate} ${browser}
Click From Language button
Click Button gt-sl-gms don't wait
However, this doesn’t look like a traditional html button so I’m not sure this approach is the one I want.
The first test passes so I know selenium is working but the second test is failing.
Can someone please help?
Thanks
Try to use xpath and the keyword “Click Element”: