Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PhantomJS和Selinium没有获取某些页面元素_Python_Selenium_Phantomjs - Fatal编程技术网

Python PhantomJS和Selinium没有获取某些页面元素

Python PhantomJS和Selinium没有获取某些页面元素,python,selenium,phantomjs,Python,Selenium,Phantomjs,所以当我尝试浏览NewEgg网站的不同部分时。我在另一个台阶上卡住了。若你们访问,你们可以看到右边的Shoprunner页面加载后免费2天发货。屏幕已连接 当我选择Firefox作为驱动程序时,它会正常工作,但当我选择PhantomJS时,它不会在ShopRunner下登录文本,而是生成以下页面: 正如你所看到的,现在SHOPRUNNER的商标和文字在这里 我从Selinium得到以下错误: raise exception_class(message, screen, stacktrace) N

所以当我尝试浏览NewEgg网站的不同部分时。我在另一个台阶上卡住了。若你们访问,你们可以看到右边的Shoprunner页面加载后免费2天发货。屏幕已连接

当我选择Firefox作为驱动程序时,它会正常工作,但当我选择PhantomJS时,它不会在ShopRunner下登录文本,而是生成以下页面:

正如你所看到的,现在SHOPRUNNER的商标和文字在这里

我从Selinium得到以下错误:

raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u'{"errorMessage":"Unable to find element with link text \'sign in\'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"95","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:52827","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{\\"using\\": \\"link text\\", \\"sessionId\\": \\"f8ac9fc0-6b17-11e4-81d1-212ddc897fa8\\", \\"value\\": \\"sign in\\"}","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/f8ac9fc0-6b17-11e4-81d1-212ddc897fa8/element"}}' ; Screenshot: available via screen
代码如下:

             from selenium import webdriver
             driver.get('http://www.newegg.com/Product/Product.aspx?Item=N82E16826104328&RandomID=8406339484211620141105131308')
            sleep(120)#this does not make any difference either.
            driver.save_screenshot('screen_aftersignin.png')
            driver.find_element_by_link_text('sign in').click()