Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: getDomAttrtibute does not return the value after entering anything inside the textbox and print it #14896

Open
shreyans1223 opened this issue Dec 13, 2024 · 2 comments

Comments

@shreyans1223
Copy link

What happened?

Selenium Version: 4.27.0

Reproducible browsers: Chrome(V131), Edge(V131)

Steps to reproduce:

  1. Open any browser
  2. Add text into the textbox
  3. print the value using the getDomAttrtibute

Note: Issue does not reproducible for the getAttrtibute property.

How can we reproduce the issue?

public class getTextBoxValue() {
      public static void main(String[] args) {
           WebDriver driver = new ChromeDriver();
           driver.manage().window().maximize();
           driver.get("http://www.automationpractice.pl/index.php");

          WebElement element = driver.findElement(By.name("search_query"));
          element.click();
          element.sendKeys("iPhone");

          System.out.println(element.getDomAttrtibute("value"));
      }
}

Relevant log output

There is no value printed in console after running above script.

Operating System

Windows 11

Selenium version

Java(V21) & Selenium(4.27.0)

What are the browser(s) and version(s) where you see this issue?

Chrome(V131), Edge(V131)

What are the browser driver(s) and version(s) where you see this issue?

Chromedriver(V131)

Are you using Selenium Grid?

No response

Copy link

@shreyans1223, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@gokulsam07
Copy link

@shreyans1223 getAttribute is deprecated, reason it didn't work is there is no corresponding value in the DOM for the attribute 'value'. Try with getDomProperty. It should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants