HENNGE / arsenic

Async WebDriver implementation for asyncio and asyncio-compatible frameworks
Other
350 stars 53 forks source link

how to receive correctly xpath ? #22

Open wku opened 6 years ago

ojii commented 6 years ago

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

VelikiiNehochuha commented 5 years ago

I think it is about xpath selector, I've done pull request for it https://github.com/HDE/arsenic/pull/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()
myhrmans commented 5 years ago

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

koloss777 commented 2 years ago

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'

DiMiTriFrog commented 2 years ago

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

Utkarsh-TG commented 2 years ago

same error...

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

Utkarsh-TG commented 2 years ago

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