Class MuiSlider
- java.lang.Object
-
- com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement
-
- com.github.grossopa.selenium.core.component.DefaultWebComponent
-
- com.github.grossopa.selenium.component.mui.AbstractMuiComponent
-
- com.github.grossopa.selenium.component.mui.inputs.MuiSlider
-
- All Implemented Interfaces:
com.github.grossopa.selenium.core.component.WebComponent,org.openqa.selenium.interactions.Locatable,org.openqa.selenium.internal.HasIdentity,org.openqa.selenium.SearchContext,org.openqa.selenium.TakesScreenshot,org.openqa.selenium.WebElement,org.openqa.selenium.WrapsDriver,org.openqa.selenium.WrapsElement
public class MuiSlider extends AbstractMuiComponent
A MUI Slider wrapper.- Since:
- 1.0
- Author:
- Jack Yin
- See Also:
- https://material-ui.com/components/slider/
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.UnaryOperator<Double>DEFAULT_INVERSE_SCALE_FUNCTION-
Fields inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
config
-
-
Constructor Summary
Constructors Constructor Description MuiSlider(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config)Constructs an instance with the delegated element and root driverMuiSlider(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, java.util.function.UnaryOperator<Double> inverseScaleFunction)Constructs an instance with the delegated element, root driver and customized scale function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MuiSliderThumb>getAllThumbs()Gets the all Thumb elements.StringgetComponentName()Gets the current component nameMuiSliderThumbgetFirstThumb()Gets the first Thumb element.java.util.function.Function<Double,Double>getInverseScaleFunction()Gets the inverse scale functionStringgetMaxValue()Gets raw max value.DoublegetMaxValueDouble()Gets max value in Double.IntegergetMaxValueInteger()Gets max value in Integer.LonggetMaxValueLong()Gets max value in Long.StringgetMinValue()Gets raw min value.DoublegetMinValueDouble()Gets min value in Double.IntegergetMinValueInteger()Gets min value in Integer.LonggetMinValueLong()Gets min value in Long.StringgetValue()Gets the raw value.DoublegetValueDouble()Gets value in Double.IntegergetValueInteger()Gets value in Integer.LonggetValueLong()Gets value in Long.booleanisInverted()Is the slider tracker inverted.booleanisVertical()Is the slider vertical.voidmoveThumb(double percentage)Moves the first thumb to the desired location in percentage.voidmoveThumb(int index, double percentage)Moves the thumb to the desired location in percentage.voidmoveThumb(MuiSliderThumb thumb, double percentage)Moves the thumb to the desired location in percentage.voidsetValue(int index, Double value)Move the target thumb to the specified value in double.voidsetValue(int index, Integer value)Move the target thumb to the specified value in Integer.voidsetValue(int index, Long value)Move the target thumb to the specified value in long.voidsetValue(MuiSliderThumb thumb, Double value)Move the target thumb to the specified value in double.voidsetValue(MuiSliderThumb thumb, Integer value)Move the target thumb to the specified value in Integer.voidsetValue(MuiSliderThumb thumb, Long value)Move the target thumb to the specified value in long.voidsetValue(Double value)Move the first thumb to the specified value in double.voidsetValue(Integer value)Move the first thumb to the specified value in Integer.voidsetValue(Long value)Move the first thumb by value.-
Methods inherited from class com.github.grossopa.selenium.component.mui.AbstractMuiComponent
isEnabled, validate
-
Methods inherited from class com.github.grossopa.selenium.core.component.DefaultWebComponent
as, attributeContains, findComponent, findComponentAs, findComponents, findComponentsAs, to
-
Methods inherited from class com.github.grossopa.selenium.core.component.AbstractDelegatedWebElement
clear, click, findElement, findElements, getAttribute, getCoordinates, getCssValue, getId, getLocation, getRect, getScreenshotAs, getSize, getTagName, getText, getWrappedDriver, getWrappedElement, isDisplayed, isSelected, sendKeys, submit, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.grossopa.selenium.core.component.WebComponent
findElement, findElements
-
-
-
-
Field Detail
-
DEFAULT_INVERSE_SCALE_FUNCTION
public static final java.util.function.UnaryOperator<Double> DEFAULT_INVERSE_SCALE_FUNCTION
-
-
Constructor Detail
-
MuiSlider
public MuiSlider(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config)Constructs an instance with the delegated element and root driver- Parameters:
element- the delegated elementdriver- the root driverconfig- the Material UI configuration
-
MuiSlider
public MuiSlider(org.openqa.selenium.WebElement element, com.github.grossopa.selenium.core.ComponentWebDriver driver, MuiConfig config, java.util.function.UnaryOperator<Double> inverseScaleFunction)Constructs an instance with the delegated element, root driver and customized scale function.- Parameters:
element- the delegated elementdriver- the root driverconfig- the Material UI configurationinverseScaleFunction- the INVERSE function of the original scale function
-
-
Method Detail
-
getComponentName
public String getComponentName()
Description copied from class:AbstractMuiComponentGets the current component name- Specified by:
getComponentNamein classAbstractMuiComponent- Returns:
- the current component name
-
getInverseScaleFunction
public java.util.function.Function<Double,Double> getInverseScaleFunction()
Gets the inverse scale function- Returns:
- the inverse scale function
-
getValue
public String getValue()
Gets the raw value.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 59049
- Returns:
- the raw value in String.
-
getValueInteger
public Integer getValueInteger()
Gets value in Integer.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 59049
- Returns:
- the value in Integer.
-
getValueLong
public Long getValueLong()
Gets value in Long.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 59049
- Returns:
- the value in Long
-
getValueDouble
public Double getValueDouble()
Gets value in Double.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 59049
- Returns:
- the value in double
-
getMinValue
public String getMinValue()
Gets raw min value.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={2}, max={8}, scale={(x) => x ** 10}, then it should return 1024
- Returns:
- the raw min value.
-
getMinValueInteger
public Integer getMinValueInteger()
Gets min value in Integer.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={2}, max={8}, scale={(x) => x ** 10}, then it should return 1024
- Returns:
- the min value in Integer.
-
getMinValueLong
public Long getMinValueLong()
Gets min value in Long.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={2}, max={8}, scale={(x) => x ** 10}, then it should return 1024
- Returns:
- the min value in Long
-
getMinValueDouble
public Double getMinValueDouble()
Gets min value in Double.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={2}, max={8}, scale={(x) => x ** 10}, then it should return 1024
- Returns:
- the min value in double
-
getMaxValue
public String getMaxValue()
Gets raw max value.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 60466176
- Returns:
- the raw max value.
-
getMaxValueInteger
public Integer getMaxValueInteger()
Gets max value in Integer.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 60466176
- Returns:
- the max value in Integer.
-
getMaxValueLong
public Long getMaxValueLong()
Gets max value in Long.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 60466176
- Returns:
- the max value in Long
-
getMaxValueDouble
public Double getMaxValueDouble()
Gets max value in Double.If the slider is with scale function configured, it will return the scaled value, for example, when the position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then it should return 60466176
- Returns:
- the max value in double
-
getFirstThumb
public MuiSliderThumb getFirstThumb()
Gets the first Thumb element.- Returns:
- the first Thumb element.
-
getAllThumbs
public List<MuiSliderThumb> getAllThumbs()
Gets the all Thumb elements. they are sorted by the value in ascending order.- Returns:
- the all Thumb elements.
-
isVertical
public boolean isVertical()
Is the slider vertical.- Returns:
- true if the slider has orientation="vertical" specified.
-
isInverted
public boolean isInverted()
Is the slider tracker inverted.- Returns:
- true if the slide has track="inverted" specified.
-
setValue
public void setValue(Integer value)
Move the first thumb to the specified value in Integer.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
value- the new integer value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(int index, Integer value)Move the target thumb to the specified value in Integer. Note the MUI thumb is always ordered by value in ascending order.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
index- the thumb indexvalue- the new integer value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(MuiSliderThumb thumb, Integer value)
Move the target thumb to the specified value in Integer.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
thumb- the target thumb to movevalue- the new double value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(Long value)
Move the first thumb by value.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
value- the new long value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(int index, Long value)Move the target thumb to the specified value in long. Note the MUI thumb is always ordered by value in ascending order.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
index- the thumb indexvalue- the new integer value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(MuiSliderThumb thumb, Long value)
Move the target thumb to the specified value in long.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
thumb- the target thumb to movevalue- the new double value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(Double value)
Move the first thumb to the specified value in double.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
value- the new double value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(int index, Double value)Move the target thumb to the specified value in double. Note the MUI thumb is always ordered by value in ascending order.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
index- the thumb indexvalue- the new double value to set- See Also:
moveThumb(double)
-
setValue
public void setValue(MuiSliderThumb thumb, Double value)
Move the target thumb to the specified value in double.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified value may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately set the value as 555 as the only possible locations are 55px and 56px for 550 and 560.
If the slider is with scale function configured, it will accept the value as scaled value, for example, when when the expected position is at 50%, min={0}, max={6}, scale={(x) => x ** 10}, then the value should be 59049
- Parameters:
thumb- the target thumb to movevalue- the new double value to set- See Also:
moveThumb(double)
-
moveThumb
public void moveThumb(double percentage)
Moves the first thumb to the desired location in percentage.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified percentage may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately move the thumb to a position like 55.5% for value 555 as the only possible locations are 55px and 56px for 550 and 560.
- Parameters:
percentage- the percentage to move to, must between [0.0, 1.0]
-
moveThumb
public void moveThumb(int index, double percentage)Moves the thumb to the desired location in percentage.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified percentage may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately move the thumb to a position like 55.5% for value 555 as the only possible locations are 55px and 56px for 550 and 560.
- Parameters:
index- the index of the thumbspercentage- the percentage to move to, must between [0.0, 1.0]
-
moveThumb
public void moveThumb(MuiSliderThumb thumb, double percentage)
Moves the thumb to the desired location in percentage.Please note that due to this action is to simulate the user web page behaviour so it is possible that the specified percentage may not accurately reflect the real value, an example is that:
- min value : 0
- min value : 1000
- slide width: 100px
so it is not possible to accurately move the thumb to a position like 55.5% for value 555 as the only possible locations are 55px and 56px for 550 and 560.
- Parameters:
thumb- the thumb component to movepercentage- the percentage to move to, must between [0.0, 1.0]
-
-