Selenium Webdriver - Unable to find element after page refresh/redirect

Siva

I am trying to write some UI test cases for an SAP-webUI (web based) application. After login, it shows the dashboard ( Workcenter's ) screen.

Now the problem is, I am able to open the page, enter U/N, Pwd and login through Selenium. After i press the "Login" button the URL changes and the page got redirected/refreshed.

E.g. URL before login : https://a/b/c/d/e/f/g.htm?sap-client=001&sap-sessioncmd=open

E.g. URL after successful Login : https://a/b(bDsdfsdsf1lg==)/c/d/e/f/g.htm

After this im unable to perform any action or press any link in any part of the page. I tried with all the possible attributes ( css, xpath, id ). Webdriver was unable to find any element on the page. It shows the error "No element found" alone.

I am using java with Selenium Web Driver.

Please find the html structure of the webpage below

<html><body><div><div><iframe>#document<html><head></head><frameset><frameset><frame>#document<html><head></head><body><form><div><div><table><tbody><tr><td><div><ul><li><a id=abcdef></a></li></ul></div></td></tr></tbody></table></div></div></form></body></html></frame></frameset></frameset></html></iframe></div></div></body></html>

Actually i want to click a linkmenu "abcd", which is inside iframe and frame as shown in the below HTML code

<html><head></head><body><iframe name=a1><html><head></head><frameset><frameset name=fs1><frame name=f1><html><head></head><body><table><tbody><tr><td><ul><li><a id=abcdef>

I tried the below code as well.

driver.switchTo().frame("a1"); driver.findElement(By.id("abcd")).click();

OR

driver.findElement(By.xpath("//*[@id='abcd']")).click();

After using the above code, still im getting the error "No such element"

Kindly suggest

Regards, Siva

Vivek Singh

Do it this way...

driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@name='a1']"))); // switching to iframe

followed by

driver.switchTo().frame("f1"); // switch to frame

and then your desired action...

driver.findElement(By.id("abcd")).click();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Selenium Webdriver - Unable to find element after page refresh/redirect

From Dev

I/O Exception and Unable to find element In IE using Selenium Webdriver

From Dev

Selenium webdriver with python to scrape dynamic page cannot find element

From Dev

Unable to click on element - Selenium WebDriver

From Dev

Selenium WebDriver cannot find element

From Dev

Selenium Unable to Find Element

From Dev

Selenium Unable to Find Element

From Dev

Selenium WebDriver: unable to locate element (C#)

From Dev

Unable to change value to element dynamically in Selenium Webdriver

From Dev

Selenium webdriver - unable to locate an element on youtube

From Dev

Selenium WebDriver Unable to locate element in link

From Dev

Unable to locate the Element on Canvas using Selenium WebDriver

From Dev

Unable to access element of the dropdown using selenium webdriver

From Dev

Unable to find element in the table using Selenium Webdriver when automating Dynamics 365 CRM

From Dev

Unable to find button element SELENIUM

From Dev

Selenium unable to find element SOMETIMES

From Dev

Unable to find button element SELENIUM

From Dev

How to find element having dynamic ID / Name changing on every page load using Selenium WebDriver

From Dev

How to find an element dynamically loaded by jQuery in page through Selenium, WebDriver and Python

From Dev

Selenium Webdriver IE could not find element

From Dev

How to find an Element by index in selenium webdriver for java

From Dev

Selenium WebDriver does not find element by XPATH

From Dev

Find element by text in xpath not working - selenium webdriver

From Dev

Find Element By Text Using Selenium WebDriver

From Dev

Selenium WebDriver not loading page after Firefox update

From Dev

Webdriver Automation - Unable to find element using xpath (in Octane 2.0 Benchmark page)

From Dev

Is this a promise error? Selenium-webdriver test fails to find element after submitting a successful login

From Dev

WebDriver Selenium: Need to select element in the table after some element

From Dev

Unable to find a web-element with Selenium

Related Related

  1. 1

    Selenium Webdriver - Unable to find element after page refresh/redirect

  2. 2

    I/O Exception and Unable to find element In IE using Selenium Webdriver

  3. 3

    Selenium webdriver with python to scrape dynamic page cannot find element

  4. 4

    Unable to click on element - Selenium WebDriver

  5. 5

    Selenium WebDriver cannot find element

  6. 6

    Selenium Unable to Find Element

  7. 7

    Selenium Unable to Find Element

  8. 8

    Selenium WebDriver: unable to locate element (C#)

  9. 9

    Unable to change value to element dynamically in Selenium Webdriver

  10. 10

    Selenium webdriver - unable to locate an element on youtube

  11. 11

    Selenium WebDriver Unable to locate element in link

  12. 12

    Unable to locate the Element on Canvas using Selenium WebDriver

  13. 13

    Unable to access element of the dropdown using selenium webdriver

  14. 14

    Unable to find element in the table using Selenium Webdriver when automating Dynamics 365 CRM

  15. 15

    Unable to find button element SELENIUM

  16. 16

    Selenium unable to find element SOMETIMES

  17. 17

    Unable to find button element SELENIUM

  18. 18

    How to find element having dynamic ID / Name changing on every page load using Selenium WebDriver

  19. 19

    How to find an element dynamically loaded by jQuery in page through Selenium, WebDriver and Python

  20. 20

    Selenium Webdriver IE could not find element

  21. 21

    How to find an Element by index in selenium webdriver for java

  22. 22

    Selenium WebDriver does not find element by XPATH

  23. 23

    Find element by text in xpath not working - selenium webdriver

  24. 24

    Find Element By Text Using Selenium WebDriver

  25. 25

    Selenium WebDriver not loading page after Firefox update

  26. 26

    Webdriver Automation - Unable to find element using xpath (in Octane 2.0 Benchmark page)

  27. 27

    Is this a promise error? Selenium-webdriver test fails to find element after submitting a successful login

  28. 28

    WebDriver Selenium: Need to select element in the table after some element

  29. 29

    Unable to find a web-element with Selenium

HotTag

Archive