0
import selenium

driver = webdriver.Firefox() 
url='web.whatsapp.com' 
driver.get(url) 

for i in range (0,10): 
    url=https://web.whatsapp.com/send?phone=9178XXX53439&text=hello
    driver.get(URL) 

its reload the whole page every time.

I want to change page content while this loop call URL without reloading page. I change this url=https://web.whatsapp.com/send?phone=9178XXX53439&text=hello every time.

radarhere
  • 929
  • 8
  • 23
L.M.AVAIYA
  • 11
  • 3
  • You cannot do this directly but you can use IFrame. Refer [Reloading Iframe](https://stackoverflow.com/questions/86428/what-s-the-best-way-to-reload-refresh-an-iframe) – Karthik Jan 02 '19 at 07:16
  • "call URL without reloading page" - do you mean by POST/GET or in iFrame? – Zydnar Jan 02 '19 at 09:45
  • Tell, what do you actually want to achive by calling this pages - get data, fire some script, or only fire some get parameters? If only fire get parameters, it would be even faster to run it with javascript in console, it is possible to do it from selenium level. – Zydnar Jan 02 '19 at 09:50
  • https://web.whatsapp.com/send?phone=9178XXX53439&text=hello when i call this url its open web whatsapp of that number and type hello in msg box. i change mobile number each time and its load page of that phone number but its take time because its reload whole page. i want to change only page content is there any way ? no any POST/GET. only but function calling. – L.M.AVAIYA Jan 03 '19 at 05:32
  • @radarhere did you find any answer for this – foxenn_pro Dec 07 '21 at 12:30
  • I didn't ask the question - I think you want to talk to L.M.AVAIYA. I just edited it. – radarhere Dec 07 '21 at 21:51

1 Answers1

0

You can load content in background using ajax in Javascript.

Try this demo

<!DOCTYPE html>
<html>
 <body>
  <div id="demo">
  <h1>The XMLHttpRequest Object</h1>
  <button type="button" onclick="loadDoc()">Change Content</button>
  </div>

<script>
function loadDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      document.getElementById("demo").innerHTML =
      this.responseText;
    }
  };
  xhttp.open("GET", "ajax_info.txt", true);
  xhttp.send();
}
</script>

 </body>
</html>
Hussein Awala
  • 4,285
  • 2
  • 9
  • 23
Dr. Kitty
  • 1
  • 3