Coder Social home page Coder Social logo

how to receive correctly xpath ? about arsenic HOT 7 OPEN

hennge avatar hennge commented on May 12, 2024 1
how to receive correctly xpath ?

from arsenic.

Comments (7)

DiMiTriFrog avatar DiMiTriFrog commented on May 12, 2024 3

I think it is about xpath selector, I've done pull request for it #58

async def test_simple_form_submit_xpath(session):
    await session.get("/html/")
    field = await session.wait_for_element(5, './/input[@name="field"]', "xpath")
    await field.send_keys("sample input")
    submit = await session.get_element('.//input[@type="submit"]', "xpath")
    await submit.click()
    h2 = await session.wait_for_element(5, ".//h2", "xpath")
    assert "sample input" == await h2.get_text()

Hi! This doesn't work with xpath. I call: await session.wait_for_element(20, '//button[text()="Войти"]', 'xpath')

And got AttributeError:

data={"using": selector_type.value, "value": selector}, AttributeError: 'str' object has no attribute 'value'

Same error

from arsenic.

ojii avatar ojii commented on May 12, 2024

I'm sorry but I do not understand what you're trying to ask. Could you explain in more detail?

from arsenic.

VelikiiNehochuha avatar VelikiiNehochuha commented on May 12, 2024

I think it is about xpath selector, I've done pull request for it #58

async def test_simple_form_submit_xpath(session):
    await session.get("/html/")
    field = await session.wait_for_element(5, './/input[@name="field"]', "xpath")
    await field.send_keys("sample input")
    submit = await session.get_element('.//input[@type="submit"]', "xpath")
    await submit.click()
    h2 = await session.wait_for_element(5, ".//h2", "xpath")
    assert "sample input" == await h2.get_text()

from arsenic.

myhrmans avatar myhrmans commented on May 12, 2024

This would be really good since its sometimes to get the exakt CSS Selector

from arsenic.

koloss777 avatar koloss777 commented on May 12, 2024

I think it is about xpath selector, I've done pull request for it #58

async def test_simple_form_submit_xpath(session):
    await session.get("/html/")
    field = await session.wait_for_element(5, './/input[@name="field"]', "xpath")
    await field.send_keys("sample input")
    submit = await session.get_element('.//input[@type="submit"]', "xpath")
    await submit.click()
    h2 = await session.wait_for_element(5, ".//h2", "xpath")
    assert "sample input" == await h2.get_text()

Hi! This doesn't work with xpath.
I call:
await session.wait_for_element(20, '//button[text()="Войти"]', 'xpath')

And got AttributeError:

data={"using": selector_type.value, "value": selector},
AttributeError: 'str' object has no attribute 'value'

from arsenic.

Utkarsh-TG avatar Utkarsh-TG commented on May 12, 2024

same error...

data={"using": selector_type.value, "value": selector},
AttributeError: 'str' object has no attribute 'value'

from arsenic.

Utkarsh-TG avatar Utkarsh-TG commented on May 12, 2024

I think it is about xpath selector, I've done pull request for it #58

async def test_simple_form_submit_xpath(session):
    await session.get("/html/")
    field = await session.wait_for_element(5, './/input[@name="field"]', "xpath")
    await field.send_keys("sample input")
    submit = await session.get_element('.//input[@type="submit"]', "xpath")
    await submit.click()
    h2 = await session.wait_for_element(5, ".//h2", "xpath")
    assert "sample input" == await h2.get_text()

Hi! This doesn't work with xpath. I call: await session.wait_for_element(20, '//button[text()="Войти"]', 'xpath')
And got AttributeError:
data={"using": selector_type.value, "value": selector}, AttributeError: 'str' object has no attribute 'value'

Same error

I found the solution

from arsenic.constants import SelectorType

field = await session.wait_for_element(5, './/input[@name="field"]', SelectorType.xpath)

this worked for me

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.