Skip to content

Commit fe011cb

Browse files
committed
Fixing retrieval of CSS properties that return non-string values in IE
This commit now properly coerces the return value of the to a string when a non-string value is returned. The actual proper fix would be to do the coersion in the JavaScript atom itself, but this will be just as effective. Fixes issue SeleniumHQ#6527.
1 parent a61cc22 commit fe011cb

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

cpp/iedriver/Element.cpp

+19-4
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,26 @@ int Element::GetCssPropertyValue(const std::string& property_name,
640640
status_code = script_wrapper.Execute();
641641

642642
if (status_code == WD_SUCCESS) {
643-
std::wstring raw_value(script_wrapper.result().bstrVal);
643+
std::wstring raw_value = L"";
644+
if (script_wrapper.ResultIsString()) {
645+
raw_value.assign(script_wrapper.result().bstrVal);
646+
} else if (script_wrapper.ResultIsInteger()) {
647+
long int_value = script_wrapper.result().lVal;
648+
raw_value = std::to_wstring(int_value);
649+
} else if (script_wrapper.ResultIsDouble()) {
650+
double dbl_value = script_wrapper.result().dblVal;
651+
raw_value = std::to_wstring(dbl_value);
652+
} else if (script_wrapper.ResultIsBoolean()) {
653+
if (script_wrapper.result().boolVal == VARIANT_TRUE) {
654+
raw_value = L"true";
655+
} else {
656+
raw_value = L"false";
657+
}
658+
}
644659
std::string value = StringUtilities::ToString(raw_value);
645-
std::transform(raw_value.begin(),
646-
raw_value.end(),
647-
raw_value.begin(),
660+
std::transform(value.begin(),
661+
value.end(),
662+
value.begin(),
648663
tolower);
649664
*property_value = value;
650665
} else {

cpp/iedriver/IEDriver.rc

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ END
5050
//
5151

5252
VS_VERSION_INFO VERSIONINFO
53-
FILEVERSION 3,14,0,13
54-
PRODUCTVERSION 3,14,0,13
53+
FILEVERSION 3,14,0,14
54+
PRODUCTVERSION 3,14,0,14
5555
FILEFLAGSMASK 0x3fL
5656
#ifdef _DEBUG
5757
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
6868
BEGIN
6969
VALUE "CompanyName", "Software Freedom Conservancy"
7070
VALUE "FileDescription", "Driver library for the IE driver"
71-
VALUE "FileVersion", "3.14.0.13"
71+
VALUE "FileVersion", "3.14.0.14"
7272
VALUE "InternalName", "IEDriver.dll"
7373
VALUE "LegalCopyright", "Copyright (C) 2018"
7474
VALUE "OriginalFilename", "IEDriver.dll"
7575
VALUE "ProductName", "Selenium WebDriver"
76-
VALUE "ProductVersion", "3.14.0.13"
76+
VALUE "ProductVersion", "3.14.0.14"
7777
END
7878
END
7979
BLOCK "VarFileInfo"

cpp/iedriverserver/CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ available via the project downloads page. Changes in "revision" field indicate
99
private releases checked into the prebuilts directory of the source tree, but
1010
not made generally available on the downloads page.
1111

12+
v3.14.0.14
13+
==========
14+
* Fixed retrieval of CSS properties that return non-string values. Fixes
15+
issue #6527.
16+
1217
v3.14.0.13
1318
==========
1419
* Fixed multiple file upload element detection.

cpp/iedriverserver/IEDriverServer.rc

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ END
5050
//
5151

5252
VS_VERSION_INFO VERSIONINFO
53-
FILEVERSION 3,14,0,13
54-
PRODUCTVERSION 3,14,0,13
53+
FILEVERSION 3,14,0,14
54+
PRODUCTVERSION 3,14,0,14
5555
FILEFLAGSMASK 0x3fL
5656
#ifdef _DEBUG
5757
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
6868
BEGIN
6969
VALUE "CompanyName", "Software Freedom Conservancy"
7070
VALUE "FileDescription", "Command line server for the IE driver"
71-
VALUE "FileVersion", "3.14.0.13"
71+
VALUE "FileVersion", "3.14.0.14"
7272
VALUE "InternalName", "IEDriverServer.exe"
7373
VALUE "LegalCopyright", "Copyright (C) 2018"
7474
VALUE "OriginalFilename", "IEDriverServer.exe"
7575
VALUE "ProductName", "Selenium WebDriver"
76-
VALUE "ProductVersion", "3.14.0.13"
76+
VALUE "ProductVersion", "3.14.0.14"
7777
END
7878
END
7979
BLOCK "VarFileInfo"
Binary file not shown.
1 KB
Binary file not shown.

0 commit comments

Comments
 (0)