SeleniumHQ/selenium · error · ArgumentError

#{num} is not greater than or equal to #{min}

Error message

#{num} is not greater than or equal to #{min}

What it means

Raised as ArgumentError by PointerEventProperties.assert_number when a property value (after passing the type check) is below the property's documented minimum in the VALID map. The min per property: width/height 0.0, pressure 0.0, tangential_pressure -1.0, tilt_x/tilt_y -90, twist 0, altitude_angle 0.0, azimuth_angle 0.0.

Source

Thrown at rb/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb:54

          VALID.each_with_object({}) do |(key, val), hash|
            next unless @opts.key?(key)

            name = val.keys.first
            values = val.values.first
            hash[name] = assert_number(@opts[key], values[:min], values[:max])
          end
        end

        private

        def assert_number(num, min, max = nil)
          return if num.nil?

          klass = min.is_a?(Integer) ? Integer : Numeric
          raise TypeError, "#{num} is not a #{klass}" unless num.is_a?(klass)

          raise ArgumentError, "#{num} is not greater than or equal to #{min}" if num < min

          raise ArgumentError, "#{num} is not less than or equal to #{max}" if max && num > max

          num
        end
      end # PointerEventProperties
    end # Interactions
  end # WebDriver
end # Selenium

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Clamp the value to the property's min: e.g. [val, min_val].max, using the min from the VALID table.
  2. Correct the source of the value — a negative pressure or below-zero width usually means a sign or unit error upstream.
  3. Pass nil to omit the property entirely (assert_number returns early on nil).

Example fix

# before
driver.action.pointer_down(:pen_contact, tilt_x: -95).perform # => ArgumentError: -95 is not greater than or equal to -90

# after
val = [-95, -90].max
driver.action.pointer_down(:pen_contact, tilt_x: val).perform
Defensive patterns

Strategy: validation

Validate before calling

VALID = Selenium::WebDriver::Interactions::PointerEventProperties::VALID
def clamped(prop, val)
  return nil if val.nil?
  min = VALID[prop].values.first[:min]
  val < min ? min : val
end

driver.action.pointer_down(:pen_contact, tilt_x: clamped(:tilt_x, computed)).perform

Prevention

When it happens

Trigger: Passing an out-of-range-low value: pressure: -0.1, tilt_x: -91, twist: -1, width: -5, tangential_pressure: -1.5.

Common situations: Pen/stylus automation where tilt/pressure are computed and can exceed physical limits; sign errors (negative pressure); defaulting a missing value to -1 as a sentinel.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/1a7453a7df8ad728. Report an issue: GitHub.