-1

During automating a website after navigating several pages I reach a page where I cannot perform any action using Selenium. Even when I try to get current title or current URL, I get the stuff from very previous page and if I do some random click anywhere on page it happens on the previous page.

In short this particular page cannot be automated or It does not have driver to perform action(driver remains on the previous page). So I want to know Is it possible that a particular page cannot be automated using selenium or a particular property that is set to prohibit doing automation.

If NO then how can I handle such situation? How can I make driver to work on current page.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jimmy
  • 35
  • 2
  • 9
  • Can you share a link to the page? It would be far easier to help you if we could see the page. – Breaks Software Aug 01 '17 at 11:35
  • thats not possible. it can only be opened using particular VPN – Jimmy Aug 01 '17 at 11:44
  • can you describe how you manually navigate to that page, and what happens on that page when you get there? I wonder if you need to add some wait time. – Breaks Software Aug 01 '17 at 11:48
  • What is the HTML content of the page like? Without looking at it, it'll be pretty hard to help you out. – Breaks Software Aug 01 '17 at 11:50
  • Is the "new page" actually a new tab or new browser window? – Breaks Software Aug 01 '17 at 11:50
  • @BreaksSoftware sir Manually it can be done easily. – Jimmy Aug 01 '17 at 11:53
  • while automating this problem rises...the page actually opens in a new browser Window...And I cant even get the window handle for it.. – Jimmy Aug 01 '17 at 11:54
  • Ah! could you edit your question to share the code that does that transition from the "previous" page, takes the action (button press?), and attempts to get the window handle for the new browser. That would be where your problem lies – Breaks Software Aug 01 '17 at 12:23
  • thats a simple click on a link that takes me to the next page where when i use simple driver.getWindowHanldle() gives me the handle of previous window and if I fetch title the title is alse from previous page.. – Jimmy Aug 01 '17 at 12:32

1 Answers1

0

From your comments, the new page is actually in the new browser window. Reading the documentation might be helpful. Here's another stackoverflow question that could help you too.

The general idea would be to use (in python) the driver.window_handles property to keep track of browser windows before and after the new window opens, then driver.switch_to_window(new_browser) so that subsequent actions point to the new browser.

Don't forget to use driver.switch_to_window() to get back to the original when you need to.

Breaks Software
  • 1,721
  • 1
  • 10
  • 15
  • I did driver.getWindowHandles()....But it returns handles of all previous windows except the current one.. – Jimmy Aug 01 '17 at 13:56
  • I have observed one thing while navigating from previous page to current page ..in between it navigates to some other page which can be seen on the tab's title..it changes from one to two and two to third title visible on tab...Can it be the cause.?..Because the driver is totally dead ...I even cant use driver.switchToDefaultContent().. – Jimmy Aug 01 '17 at 13:59
  • Can you please clarify, is the new window a *browser* window? This isn't opening some other application, is it? And what do you mean "the driver is totally dead"? – Breaks Software Aug 01 '17 at 14:48
  • the new opened window is a new browser window not the tab...and by driver I mean the driver remains on the previous page. If we want to perform any action on new page it happens on the previous page... – Jimmy Aug 03 '17 at 06:12
  • You'll have to share some of your code with us if we can be of any help. Please edit your question to add the code that triggers the new window to open, then attempts to switch to the new window. – Breaks Software Aug 03 '17 at 11:25