Webdriver.io browser.elementIdDisplayed(ID) is not returning boolean - webdriver-io

I'm trying to use webdriver.io function browser.elementIdDisplayed(element.ELEMENT), but it doesn't return a boolean as the docs says. Instead it returns some kind of object.
I'm confused, how can I get a value from this if the element is displayed or not?
Please help.
I have tried also with browser.elementIdDisplayed(element.ELEMENT).value but it is always true?

It was ok to use
browser.elementIdDisplayed(element.ELEMENT).value,
but my other logic of verifying that element was displayed was wrong.

Related

getReference() on PsiElement always returns null value

I get the PsiElement using a PsiRecursiveElementVisitor. The I call getReference() function on it but it always returns null. In my use case, I cannot use Caret for getting the reference. I am assuming the references we get from both are the same. Any help would be great!
Maybe that PsiElement simply doesn't have any references? Try with its parents.

evaljs returns nil even though it shouldn't?

The following code ...
splash:evaljs('document.querySelectorAll("iframe.iframe-container.js-oddset-game-iframe")[0].contentDocument.querySelectorAll("td.leftText a.eventLink").length')
... returns 8 - i.e. there are 8 nodes in the array.
However, when I then try to return the nodeList (array) directly, the result is nil? Obviously a table should be returned since an array is returned from the javascript code.
Is this a bug in Splash? Can't Splash handle access to elements in iframes? I have the --js-cross-domain-access option on too.
It is not a bug. iframes are only available when you use the render.json endpoint with the iframes=1 parameter. When you use that you cannot run a custom Lua script.
Refer to the documentation: https://splash.readthedocs.io/en/stable/api.html#render-json
And this answer: https://stackoverflow.com/a/44682917/4082726

WebDriver isDisplayed() returns true even if the element is hidden

The element I am looking for is as below
I want to call isDisplayed() on the highlighted span web element, and as it is hidden it should return exception. But it is returning true and continuing to the next statement.
Your question lacks a lot of information.
maybe you are looking for some of these:
ispresent()
isvisible()
textpresent()
isDisplayable()
don't know how your code looks but it should be
boolean visible=driver.findElement(By.id("yourverylongid")).isDisplayed();
or using xpath
But I am not sure if it will work because I didn't use is Displayed()

Is it meaningful to verifyText() on an element that has just had type() executed on it?

I'm curious about whether the following functional test is possible. I'm working with PHPUnit_Extensions_SeleniumTestCase with Selenium-RC here, but the principle (I think) should apply everywhere.
Suppose I execute the following command on a particular div:
function testInput() {
$locator = $this->get_magic_locator(); // for the sake of abstraction
$this->type( $locator, "Beatles" ); // Selenium API call
$this->verifyText( $locator, "Beatles" ); // Selenium API call
}
Conceptually, I feel that this test should work. I'm entering data into a particular field, and I simply want to verify that the text now exists as entered.
However, the results of my test (the verifyText assertion fails) suggest that the content of the $locator element are empty, even after input.
There was 1 failure:
1) test::testInput
Failed asserting that <string:> matches PCRE pattern "/Beatles/".`
Has anyone else tried anything like this? Should it work? Am I making a simple mistake?
You should use verifyValue(locator,texttoverify) rather than verifyText(locator,value) for validating the textbox values
To answer your initial question ("Is it meaningful ..."), well, maybe. What you're testing at that point is the browser's ability to respond to keystrokes, which would be sort of lame. Unless you've got some JavaScript code wired to some of the field's properties, in which case it might be sort of important.
Standard programmer's answer - "It depends".

Rational Functional Tester wait for object existence

I'm currently modifying a Java script in Rational Functional Tester and I'm trying to tell RFT to wait for an object with a specified set of properties to appear. Specifically, I want to wait until a table with X number of rows appear. The only way I have been able to do it so far is to add a verification point that just verifies that the table has X number of rows, but I have not been able to utilize the wait for object type of VP, so this seems a little bit hacky. Is there a better way to do this?
Jeff
No, there is not a built-in waitForProperty() type of method, so you cannot do something simple like tableObject.waitForProperty("rowCount", x);
Your options are to use a verification point as you already are doing (if it ain't broke...) or to roll your own synchronization point using a do/while loop and the find() method.
The find() codesample below assumes that doc is an html document. Adjust this to be your parent java window.
TestObject[] tables = doc.find(atDescendant(".rowCount", x), false);
If you are not familiar with find(), do a search in the RFT API reference in the help menu. find() will be your best friend in RFT scripting.
You can do one thing.... you can try getting the particular property and check that you are getting the desired value of that. If not then iterate in a IF loop.
while (!flag) {
if (obj.getproperty(".text").equals("Desired Text")) {
flag = true
}
}
You can use:
getobject.gettext();