selenium

Running Selenium on AWS Lambda

风流意气都作罢 提交于 2021-01-27 17:12:14
问题 I know this is a frequently asked question, I have checked many answers and tried everything but still can't find a solution. I am trying to run Selenium with Python 3.6 on AWS Lambda and created the deployment package using Docker. I followed the following steps for Docker: sudo docker run -v $(pwd):/outputs --name linked_in -d amazonlinux:latest tail -f /dev/null sudo docker exec -i -t linked_in /bin/bash /outputs/buildPack_py.sh This is what my buildPack_py.sh file looks like: python

Python selenium don't autoplay videos

China☆狼群 提交于 2021-01-27 16:54:14
问题 I am using the Selenium webdriver in Python and I'd like the browser to not load images or autoplay videos to save time and resources. The problem is that videos do still get played without clicking on them. Here are my settings for the webbrowser: from selenium import webdriver firefox_profile = webdriver.FirefoxProfile() # don't load images firefox_profile.set_preference('permissions.default.image', 2) firefox_profile.set_preference('extensions.contentblocker.enabled', True) firefox_profile

writing a new cell to a sheet apache poi

十年热恋 提交于 2021-01-27 16:47:03
问题 i am using following code, for reading a excel using apache poi, its a .xlsx file. Please let me know what i can do, to also alter a value of a cell, in each row as my loop keeps going. Thanks import java.io.FileInputStream; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; String fileName = "C:/createCDN.xlsx"; FileInputStream fis = null; fis = new

Python selenium don't autoplay videos

我与影子孤独终老i 提交于 2021-01-27 16:42:00
问题 I am using the Selenium webdriver in Python and I'd like the browser to not load images or autoplay videos to save time and resources. The problem is that videos do still get played without clicking on them. Here are my settings for the webbrowser: from selenium import webdriver firefox_profile = webdriver.FirefoxProfile() # don't load images firefox_profile.set_preference('permissions.default.image', 2) firefox_profile.set_preference('extensions.contentblocker.enabled', True) firefox_profile

How to handle “Unable to receive message from renderer” in chrome driver?

半世苍凉 提交于 2021-01-27 16:04:26
问题 Test Environment: chrome=73.0.3683.103 chromedriver version: 73.0.3683.68 java.version: '1.8.0_151' os.name: 'Windows 7' I am getting following error: Unable to receive message from renderer Timed out receiving message from renderer: 19.997 Timed out receiving message from renderer:-0.004 Thank you in advance for any help you may be able to provide. 回答1: This error message... Unable to receive message from renderer Timed out receiving message from renderer: 19.997 Timed out receiving message

真香~教你用15行代码爬取当代青年的网易云评论

柔情痞子 提交于 2021-01-27 14:57:24
到了深夜,这些所谓的网抑云(网易云)少年就开始“无病呻吟”了,但是他们真的使这样吗?想必大家都是因为受爱情的苦,听闻爱情,十有九悲。可是长期这样下去,带心里和身体都有巨大的伤害。长期的熬夜以及精神状态。所以在这篇文章在分享技术的同时也希望大家能想得开,把这些事看淡些,随遇而安。祝福你们每一个人能找到真正适合自己的那个藏在内心深刻的人。 好了,废话不多说,是时候展现真正的技术了。 1.无头浏览器selenium是什么? Selenium是一个用于Web应用程序测试的 工具 。Selenium测试直接运行在浏览器中,就像真正的用户在操作一样。 什么?像真正的用户在操作一样??岂不是模拟人操纵的样子,一切看上去都正正常常,不会让被爬者产生怀疑。对的,就是这么腻害。 2.selenium的优势? 自动渲染所有响应内容,可以直接绕过js加密的操作,只要是展示在浏览器上看的数据,都可以使用无头浏览器获取。 几乎可以达成可见即可爬。 使用到的第三方库,jieba库、wordcloud库、MySQLdb、numpy库。 1.先用selenium将网易云上面的某一歌曲(这里以任然的无人之岛为例)的一定数量的评论爬取并且存数据库中,进行可视化。 2.然后从数据库中把评论查找出来,进一步用词云出来评论,形成一张图片。某个词数量最多,当然了,在图片中某个词显示的越大,则这个词出现的次数,数量

Element not clickable since another element obscures it in python

放肆的年华 提交于 2021-01-27 14:45:52
问题 I am trying to automate an access point web configuration. During this, I get a pop up (kind of an overlay with "Yes" and "No") which i want to click on The HTML code for the overlay that I am trying to click on: <div id="generic-warning-dialog" class="dialog exclamation text-orphan" style=""> <div class="warning-content dialog-content text-orphan">Security Mode is disabled on one or more of your wireless networks. Your network could be open to unauthorized users. Are you sure you wish to

How can I loop over pages and get data from every page with selenium?

a 夏天 提交于 2021-01-27 14:32:15
问题 I want to do a google search and collect the links to all hits so that I can click those links and extract data from them after collecting all links. How can I get the link from every hit? I've tried several solutions like using a for loop and a while True statement. I'll show some examples of the code below. I either get no data at all or I get only data (links) from 1 webpage. Can someone please help me figure out how to iterate over every page of the google search and get all the links so

Vba - webscraping using ng-click

故事扮演 提交于 2021-01-27 14:23:25
问题 I am using Selenium and I would like to be able to click on the following <a ng-click="download()">download</a>' This is an 'a' tag. I am not sure how the code would be like to click onto an 'a' tag that has got ng-click in it. Dim d As WebDriver Set d = New ChromeDriver Const URL = "url of the website - not public" With d .Start "Chrome" .get URL .Window.Maximize .FindElementById("Search").SendKeys "information to search" .Wait 1000 .FindElementById("Submit").Click .Wait 1000 'then I need to

What is the purpose of normalize-space()?

人盡茶涼 提交于 2021-01-27 14:20:48
问题 I don't understand very well the purpose of normalize-space() . I think it's very useful. In fact, I always use it when I am doing tests, but I am not sure the principal purpose. For example, in these two cases, what are the differences? What is the advantage of using it? Example 1 WebElement seleccionLabelCabecera = findBy(xpath("(//div[contains(normalize-space(@class), 'windowViewMode-maximized active')"] Example 2 WebElement seleccionLabelCabecera = findBy(xpath("(//div[@class,