-1
@with_setup(setup_module,teardown_module)

def test_checklist():

    uname = Util.findElement("username")

    if uname.is_displayed():
        uname.send_keys("crussell")

    pwd = Util.findElement("password")

    if pwd.is_displayed():
        pwd.send_keys("welcome")

    loginelem = Util.findElement("login_btn")

    if loginelem.is_displayed():
        loginelem.click()

    wbelmnts = Util.findElements("Left_Menu")

    Util.clickElementFromList(wbelmnts, "Job Postings")

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@class='loginForm']//div[@class='formGroup']/input[@name='login']"}

  • 1
    Without the html it is not possible to judge if your xpath is correct. – Frank Mar 07 '18 at 07:55
  • No. Actually I have done the same thing in Java. Now I am trying to migrate the script in Python. So, in Java it worked fine. But I don't know why it is not working in Python. – Sagnik Sarkar Mar 07 '18 at 09:06
  • What's your question? – Donald Duck Mar 07 '18 at 09:13
  • @Donald Duck: Why the execution is slow in Python compared to Java.? I have to put time.sleep in each and every line otherwise it is throwing nosuchelementexception always. – Sagnik Sarkar Mar 07 '18 at 11:02
  • @SagnikSarkar Could you please [edit] your question to add that? Also, I recommend you read [ask], because questions that are well-written usually get good answers. – Donald Duck Mar 07 '18 at 11:51
  • @Donald Duck: I am very sorry man. Actually I was confused myself about what to ask. I will edit the question. – Sagnik Sarkar Mar 07 '18 at 13:31

1 Answers1

-1

put time.sleep(5) it will wait for a page to load.

  • Thanks Shivangi! It worked. But I didn't think like I have to wait for the page to load for sometime. Same code which i have written executed seamlessly in Java.! – Sagnik Sarkar Mar 07 '18 at 09:11