Code Monkey home page Code Monkey logo

Comments (5)

mralecthomas avatar mralecthomas commented on May 14, 2024

The built in Python function isdigit() that is found in utils.py is expecting an integer instead of the float that you are passing.

Round up your pixel value that you are passing into get_rect with math.ceil and it will fix your issue.

from arsenic.

cyberbudy avatar cyberbudy commented on May 14, 2024
    async def get_rect(self):
        data = await self._request(url="/rect", method="GET")
        return Rect(data["x"], data["y"], data["width"], data["height"])

This is get_rect method of Element. Where should I round pixel value?

I'm calling this method on found Element, something lile:

element = await session.get_element("#my-selector")
# Exception is raised here
element.get_rect()

from arsenic.

mralecthomas avatar mralecthomas commented on May 14, 2024

You can try modifying your px_to_int() method in utils.py to the following:

def px_to_int(value: str) -> int:
    original = value
    if value.endswith("px"):
        value = value[:-2]
    value = math.ceil(value)
    if value.isdigit():
        return int(value)
    else:
        raise ValueError(f"{original!r} is not an int or <int>px value")

Don't forget to add:

from math import ceil

from arsenic.

cyberbudy avatar cyberbudy commented on May 14, 2024

Do you mean a pull request with your modification?

from arsenic.

ojii avatar ojii commented on May 14, 2024

fixed in 20.9

from arsenic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.