How to verify tooltip text using Karate - automation

How to verify tooltip text using Karate?
Upon hovering mouse over the element, tooltip text is displayed. I need to verify the tooltip text.

Related

robotframework- unable to click a button on a modal dialogue box

when I open a particular webpage it has a EULA form that appears on top of the home page in the form of a modal in HTML/CSS. I have tried the XPath of the accept button but it says element not found also tried using handle alert.
is there a unique way to handle a dialogue box in robotframework?
image of HTML in inspect view
SeleniumLibrary.Set Focus To Element ${button_on_popup_page}
SeleniumLibrary.Click Element ${button_on_popup_page}
I figured it out, shown in the above code. I first set focus to the button and then used the click element. This seemed to work.

How to unfocus from all inputs/elements in Selenium without tabbing out

I have a form where I fill in textboxes through selenium (java). Some of the textboxes dynamically generate extra content when you click on them and remove the content when you focus on something else. This is a problem when I automate because if I am focused on a text box and try to click on something else, when the page removes the content it doesn't register my click and I need to click again. This leads to flakey behaviour since I need to now consider whether I need to click or double click a button depending on what element I was focused on before.
I can't send a tab key to the text box because sometimes it will tab into another textbox that has the same dynamic generation behaviour, leading to the same scenario as before.
I tried clicking the page element but it also doesn't seem to work. I also tried clicking the root div. It just doesn't seem to register my click (I also tried jsclicks)
What I would like to do is have a general way to unfocus a text box after I fill it.
Thanks!

selenium, hidden button by overlapped input ( not clickable)

Is there any way on how to click a hidden button by an overlapped input text field, for example if you go to www.google.com and enter a text to search for, selenium can not find the "Search Google" button because it is hidden by the autocomplete of the text field.
Thanks.
You can bypass the validation by using #click! instead of #click. Basically, this triggers the click via JavaScript rather than through standard Selenium commands.
browser = Watir::Browser.new
browser.goto('www.google.com')
browser.text_field(name: 'q').set('watir')
browser.button(name: 'btnK').click!
If you are only using Selenium, you can do:
btn = driver.find_element(name: 'btnK')
driver.execute_script('arguments[0].click();', btn)
As discussed in the comments, you could also close the suggestions box before trying to click the button. You can do this by moving focus to any other element - eg the first link on the page. Depending on what you're testing, this may or may not have value.
browser.text_field(name: 'q').set('watir')
browser.link.focus # move focus to any other element so suggestions close
browser.button(name: 'btnK').click

How to label return key in custom keyboard based on text input type

I am creating a custom keyboard. I have a button for Return/Go/etc. If the user is entering a URL, my button text should be "Go". If she is writing in note, it should be "Return".
How can my keyboard extension figure out what label to put on the button?
Your text document proxy conforms to UITextInputTraits, so you want to use self.textDocumentProxy.returnKeyType or .keyboardType.

Selenium - How to click OK button in a pop up using text containing in that button

The code below is shown in firebug for the OK button in the popup of my application
<button id="ext-gen219" class="x-btn-text" type="button">
OK
</button>
Here the button id is randomly generated and also the position of ok button is not identifiable. Is there a way to click on the button by its text? Like the button contains a text called OK.
For Selenium IDE or Selenium RC, xpath=//button[contains(., 'OK')] ought to be a good locator.
I am going on the premise that the text of the popup boxes are not identical so I would recommend something like this:
List<IWebElement> dialogBox = driver.FindElements(By.Class("dialogBoxClass");
int buttonIndex = dialogBox.FindIndex(i => i.FindElement(By.Class("DisplayedTextElementClass").Text.Contains("some unique text here"));
dialogBox[buttonIndex].FindElement(By.ClassName("x-btn-text")).Click();
This captures the parent element of all the dialog boxes and then parses each object to find the index of the box you want and then clicks on the 'Ok' button in the correct object.
In case of a submit button this locator css=input:submit[value="OK"] should work. In case of a button element take css=button:contains("OK").