arsenic icon indicating copy to clipboard operation
arsenic copied to clipboard

how to receive correctly xpath ?

Open wku opened this issue 6 years ago • 7 comments

wku avatar Sep 18 '17 16:09 wku

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

ojii avatar Oct 23 '17 06:10 ojii

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()

VelikiiNehochuha avatar Feb 09 '19 10:02 VelikiiNehochuha

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

myhrmans avatar Mar 26 '19 16:03 myhrmans

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'

koloss777 avatar Sep 18 '21 08:09 koloss777

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

DiMiTriFrog avatar Oct 02 '21 09:10 DiMiTriFrog

same error...

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

Utkarsh-TG avatar May 20 '22 05:05 Utkarsh-TG

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

Utkarsh-TG avatar May 20 '22 06:05 Utkarsh-TG