question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to getText() from an element using Java?

See original GitHub issue

When I call getText() upon an element I’m getting the following message:

NO GET TEXT (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 16 milliseconds Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700' System info: host: 'd-1816', ip: '10.10.25.26', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0' Driver info: org.openqa.selenium.winium.WiniumDriver Capabilities [{app=C:\Windows\system32\calc.exe, args=, innerPort=9998, debugConnectToRunningApp=false, keyboardSimulator=1, launchDelay=0, platform=ANY}] Session ID: AwesomeSession

Is there a way of getting an elements text with Winium?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
NickAbcommented, Feb 17, 2017

getText should work independently of bindings language you chose to use.

In case of windows calc.exe you should use Name property on the result element, not getText.

Here is sample in python

window.find_element_by_id('150').get_attribute('Name')

Please make sure that the element itself has a text value. If some child of found element has the text, no the element you located, then try get this child element first and call getText on the child.

Internally Winium tries to use TextPattern first, then ValuePattern to get text of the element. If the element does not support those automation patterns (i.e. it is some custom element that does not implement patterns), then the method will fail.

0reactions
joshidipakkumarcommented, May 18, 2018

Applicable to java as well. I used it for to get a label displayed on a Button. driver.findElement(By.id(“id”)).getAttribute(“name”);

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Get Text of an Element in Selenium: Tutorial
getText() method returns string as a result. It removes the whitespaces if present in the front and back of the string. Note: Using...
Read more >
How To Get Text Of An Element In Selenium?
The getText() method in Selenium WebDriver is a powerful tool for retrieving the visible text of a specific web element. By calling this...
Read more >
Selenium getText - java
getText() returns the visible text of this element. java.lang.String getText() Get the visible (i.e. not hidden by CSS) text of this element, ...
Read more >
How to get text from Selenium element WebElement object
We can get text from a webelement with Selenium webdriver. The getText() methods obtains the innerText of an element. It fetches the text...
Read more >
getText() method in Selenium Java with Examples
getText() method is used to get the visible text of an element in Selenium. This post will discuss the getText() method of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found