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

Selenium 3.5.0-GeckoDriver : getPlatform() method and map.get("platform") method returns different results for Platform through geckodriver #895

Closed
Debanjan-B opened this issue Aug 23, 2017 · 4 comments

Comments

@Debanjan-B
Copy link

Debanjan-B commented Aug 23, 2017

getPlatform() method and map.get("platform") method returns different results for Platform through geckodriver.

cap.getPlatform().toString() returns Platform as XP while map.get("platform") returns Platform as ANY

System

  • GeckoDriver Version: 0.18.0
  • Platform: Windows8 Pro, 64 bit
  • Firefox: Firefox: 55.0.2 (64-bit)
  • Selenium: 3.5.0

Testcase

Minimum Code Block:

package demo;

import java.util.Map;

import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.RemoteWebDriver;

public class WEBDRIVER_Platform
{
	public static void main(String[] args) 
	{
		String attribute = "platform";
		System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
		WebDriver driver = new FirefoxDriver();
		Capabilities cap = ((RemoteWebDriver) driver).getCapabilities();
		System.out.println("Platform is : "+cap.getPlatform().toString());
		Map<String, ?> map = cap.asMap();
		Object value = map.get(attribute);
		System.out.println("Key : " + attribute + " Value :"+ value);
	}
}

Stacktrace

Console output:

Platform is : XP
Key : platform Value :ANY
@Debanjan-B Debanjan-B changed the title Selenium 3.5.0-GeckoDriver : getPlatform() method and map.get(attribute) method returns different results for Platform through geckodriver Selenium 3.5.0-GeckoDriver : getPlatform() method and map.get("platform") method returns different results for Platform through geckodriver Aug 23, 2017
@andreastt
Copy link
Contributor

I think (?) this is a duplicate of #897

@Debanjan-B
Copy link
Author

@andreastt Here is the detailed analysis for you:

The Capabilities Class returns a Map<String, ?> type of object which includes capabilities like platform, and platformName.

Issue #897 deals with the capability platformName which should have been windows but geckodriver is returning windows_nt which is altogether a separate Bug.

This issue tries to highlight the inconsistency regarding the platform parameter like, if we analyze the raw Map<String, ?> type of object returned by getCapabilities() method, the key platform returns a value ANY where as the direct wrapper method getPlatform() returns a value XP

Maybe, @AutomatedTester and @shs96c can help us with a more deeper analysis if both/any of them are wrong/correct.

@andreastt
Copy link
Contributor

That sounds like a client API issue.

@lock
Copy link

lock bot commented Aug 17, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have run into an issue you think is related, please open a new issue.

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants