title: How to convert the Selenium with Chrome code into PhantomJS?
body: <p>I have written some code to scrape a web page using selenium. It is working fine if I use Chrome web driver. But if i change it to <code>PhantomJS()</code>, i am getting error saying no such element exception. The code is:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests
  from selenium import webdriver
  from time import sleep
  s = requests.session()
  driver = webdriver.Chrome('F:\chromedriver')
  driver.get("https://in.bookmyshow.com/booktickets/VMAX/2061")
  sleep(40)
  # To switch to frame
  driver.switch_to.frame(driver.find_element_by_id("wiz-iframe"))
  
  # Clicking on the element inside the frame
  e2 = driver.find_element_by_xpath("//div[@class='wzrkPPwarp']//a")
  e2.click()
  
  # Switching back to main content
  driver.switch_to_default_content()
  
  # Then only we can access elements
  e3 = driver.find_element_by_xpath("//button[@class='No thanks']")
  e3.click()
  </code></pre>
  
  <p>This is the code written using Chrome web driver. When i change this to:</p>
  
  <pre><code>driver = webdriver.PhantomJS()
  </code></pre>
  
  <p>I am getting the error as below:</p>
  
  <blockquote>
    <p>NoSuchElementException: Message: {"errorMessage":"Unable to find element with xpath '//div[@class='wzrkPPwarp']//a'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"113","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:56829","User-Agent":"Python http auth"},"httpVersion":"1.1","method":"POST","post":"{\"using\": \"xpath\", \"value\": \"//div[@class='wzrkPPwarp']//a\", \"sessionId\": \"ccc33320-10e5-11e8-b5fa-dbfae1ffdb07\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/ccc33320-10e5-11e8-b5fa-dbfae1ffdb07/element"}}
        Screenshot: available via screen</p>
  </blockquote>
  
  <p>How to make it correct? Please help. Thanks!</p>