SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

Unify "index" type of keyword arguments.

Open rasjani opened this issue 2 years ago • 3 comments

create_webdriver was marked as returning a str, however, its return value is coming from register_driver which is documented to return int. These where changed to return actual int.

switch_driver was only accepting str as "index_or_alias". While aliases are str's since create_driver now returns the actual index as int, accepting both types makes more sense.

select and unselect list keywords where typehinted to receive only str as index type - when called from python side, this does not make much sense so changed those to int as RF should do type conversion automatically.

Fixes #1791

rasjani avatar Oct 12 '22 15:10 rasjani

no tests have been written nor executed ..

rasjani avatar Oct 12 '22 15:10 rasjani

One overarching thought is I would want this to be backwards compatible. Such that this change does not force people to change all their select from list by index calls. So I would want the Robot Type conversion from the robot side to take those strings and automatically convert those to ints in all cases that switch from incoming str to incoming int.

Adding some inline comments as well ..

emanlove avatar Oct 13 '22 00:10 emanlove

Don't have time to review this right now, but I have one possible idea related to this. We recently changed Robot's Process library to return actual process objects, not handles (e.g. ints), and it has worked great. Could Create Webdriver return the created WebDriver instance as well?

pekkaklarck avatar Oct 13 '22 21:10 pekkaklarck