Skip to content

Commit 97a0351

Browse files
Update README.md
1 parent a85112b commit 97a0351

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

README.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
# SeleniumDynamicMoveSlider
1+
# Selenium Sliders Library -by James
2+
3+
24
Small library for manipulating sliders by simply passing the amount you want to move the slider to using the Selenium Web Driver
35

46
if you know that the incriment of the slider will be constant then simply pass them through the MoveSliderWithInfo Subroutine, This takes in the Max & Min values, Incriment, and the slider & selenium driver as arguments as well as the amount you want to move the slider to for assertion testing, use in a forloop with the data you have to assert against and save a heck-load of time :).
5-
----------------------------------------------------------------------------------------------------------------------------------------
7+
8+
<hr>
69

710
### Method List ###
811

912
**The next 3 methods are used for specifying a numerical amount, converting it to a pixel value and then moving the slider specified, this is very useful if you only have test data in actual amounts instead of pixel values**
1013

11-
----------------------------------------------------------------------------------------------------------------------------------------
14+
<hr>
15+
1216
MoveSliderWithInfo(int SliderMax, int SliderMin, decimal Amount, IWebElement Slider, IWebDriver driver)
1317

1418
supply the method with the maximum value of the slider (what is actually output to the user), the mininum value of the slider, the amount you want the slider moved to, the slider you want moved as an IWebElement and the driver being used as an IWebDriver.
1519

1620
Comes with overloads for Amount in any numerical format or as a string with a basic non-numerical symbol removal filter
1721

18-
----------------------------------------------------------------------------------------------------------------------------------------
22+
<hr>
1923

2024
MoveSliderNoInfo(IWebDriver driver, IWebElement slider, dynamic amount)
2125

@@ -24,7 +28,7 @@ This is meant to be used when you do not know the maximum or mininum values of t
2428
Supply the method with the driver being used, the slider you want moved and the amount as a dynamic, the method will then construct the values from the slider element to call the MoveSliderWithInfo and move the slider to the amount specified above.
2529

2630

27-
----------------------------------------------------------------------------------------------------------------------------------------
31+
<hr>
2832

2933
MoveSliderUsingTextBox(IWebElement Slider, IWebElement textBox, IWebDriver driver, decimal Amount)
3034

@@ -33,27 +37,27 @@ This is meant to be used when you don't know the maximum or mininum values of th
3337
It employs a basic filter method that removes any non numerical symbols which I wrote myself, this is an almost worst case scenario method where the user will not know the max/min values in the browser and they are not explicity contained inside the IwebElement, it however does work as well as any other method listed above provided the correct information is passed to it.
3438

3539

36-
----------------------------------------------------------------------------------------------------------------------------------------
40+
<hr>
3741

3842
MoveSlider(IWebElement Slider, IWebDriver driver, int Pixels)
3943

4044
This is what's called to actually move the slider, If you already know the exact pixel value from the mininum that the slider has to move then you are able to directly call this subroutine and it will move the slider to the positon you want it to be but otherwise call the most appropriate method from above to do the amount to pixel conversion and movement automatically
4145

42-
----------------------------------------------------------------------------------------------------------------------------------------
46+
<hr>
4347

4448
GetIncrement(IWebDriver driver, IWebElement Slider, IWebElement textBox, decimal SliderMin)
4549

4650
A nifty little subroutine that will find the smallest amount that the slider can be adjusted by, useful for testing.
4751

4852

49-
----------------------------------------------------------------------------------------------------------------------------------------
53+
<hr>
5054

5155
Filter(string TextBoxText)
5256

5357
This is used for taking an input, removing any non-numerical characters and returning the result as a decimal. This is used primarily in the "MoveSliderUsingTextBox" subroutine where the actual output from the slider through the speicfied textbox is used to calculate the amount of pixels necessary to move the slider. For example if you had a slider which output £2,000.00, the £ and , would throw an illegal input exception, this subroutine means that the program only sees "2000.00" as it only keeps numbers 0-> 9 and a decimal point.
5458

5559

56-
----------------------------------------------------------------------------------------------------------------------------------------
60+
<hr>
5761

5862
GetPixelsToMove(IWebElement Slider, decimal Amount, decimal SliderMax, decimal SliderMin)
5963

@@ -62,7 +66,7 @@ This is where the majority of the mathematical calculation is done, using a math
6266
This is the most vital and most versatile part of the program as it allows the user to input an amount e.g. £2000 and get the exact number of pixels the slider must be moved by as if the user asked the computer to move the slider £2000 across it would have no idea how to handle it. This allows a raw amount to be converted to a pixel value to maximum usability.
6367

6468

65-
----------------------------------------------------------------------------------------------------------------------------------------
69+
<hr>
6670

6771

6872
I made this for a placement last month and thought it was okay enough to put up here, equation for converting amount to a pixel value was done by me, ClickAndHold was done by a senior software engineer Declan McGill, I have to thank him for his help making this.

0 commit comments

Comments
 (0)