LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-05-2017, 09:10 PM   #1
project.linux.proj
Member
 
Registered: Dec 2012
Posts: 80

Rep: Reputation: Disabled
In Selenium with python, after choosing drop down option page refresh but giving values of previous page


When I choose the next page from the drop down, page refreshes when I choose values by python program it gives me the value of previous page. Though the same query on firebug reaches the correct values but python program unable to fetch values in new page.


<tr>
<td headers="SINCE">18-FEB-16</td>
<td headers="TOKEN">
<span style="font-family:mono,new courier;font-size:14;color:darkgreen;font- weight:bold">vavFeth3</span>
</td>
<td headers="STATUS">
 
Old 07-06-2017, 12:08 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,583
Blog Entries: 11

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599
Please place your code snippets inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.

While I am not familiar with Selenium (?), the HTML snippet you have posted does not have any obvious relevance to your problem description.

My first impression is that what you describe results from a browser page cache and is unrelated to any python code, but as you have not provided any useful details of the actual problem or the code it is impossible to say.

Please see this Site FAQ page and the links in it for help in asking a more complete question.
 
Old 07-06-2017, 09:15 AM   #3
project.linux.proj
Member
 
Registered: Dec 2012
Posts: 80

Original Poster
Rep: Reputation: Disabled
First I fetched values of first page in fetched_passwd then went to next page and then tried to fetch values of next page in fetched_passwd1 but still previous values are being stored. if I run the same query (//*[@headers='TOKEN']//following::span[2]) on firebug on new page it find correct values but python program it doesn't fetch new values.

Python Code:
Code:
fetched_passwd=browser.find_elements_by_xpath("//*[@headers='TOKEN']//following::span[2]")
sum=0
for i in fetched_passwd :
    print(i.text)
    sum=sum+1
    if(sum==9):
        break


next_page=browser.find_element_by_xpath("//*[@id='X01_5011970802493527']//following::option[1]").click()

fetched_passwd1=browser.find_elements_by_xpath("//*[@headers='TOKEN']//following::span[2]")
sum=0
for j in fetched_passwd1 :
    print(j.text)
    sum=sum+1
    if(sum==10):
        break

Below is the html code that I find on webpage.
Code:
<tr>
<td headers="SINCE">18-FEB-16</td>
<td headers="TOKEN">
<span style="font-family:mono,new courier;font-size:14;color:darkgreen;font- weight:bold">vavFeth3</span>
</td>
<td headers="STATUS">
 
Old 07-13-2017, 09:44 AM   #4
project.linux.proj
Member
 
Registered: Dec 2012
Posts: 80

Original Poster
Rep: Reputation: Disabled
Can anybody help me ?
 
Old 07-15-2017, 02:07 AM   #5
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
I guess you should wait for page to load. Add delay or, better, wait for some condition determining that page is loaded.
 
1 members found this post helpful.
Old 06-21-2019, 11:23 AM   #6
linux_project
LQ Newbie
 
Registered: Apr 2015
Posts: 11

Rep: Reputation: Disabled
@firstfire: Increasing timeout fixed it. Thanks
 
  


Reply

Tags
python


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to refresh a web page vinaytp Linux - Newbie 6 06-12-2009 12:55 AM
Next - Previous Page Buttons / Search this Thread Button JZL240I-U LQ Suggestions & Feedback 5 11-09-2005 07:40 AM
Refresh entire page jnusa Programming 3 11-10-2004 04:26 PM
Apache web page - refresh dvong3 Linux - General 7 06-26-2003 01:36 PM
Refresh Web Page dvong3 Linux - General 1 10-03-2002 08:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration