htmlunit

Login to LinkedIn using HtmlUnit and navigate to Connections Web page

杀马特。学长 韩版系。学妹 提交于 2019-12-23 06:01:37
问题 Currently I am trying to login to LinkedIn using HtmlUnit 2.20. But I am not able to login. Below is my code. public static void Login(String username, String password) { final WebClient webClient = new WebClient(BrowserVersion.CHROME); try { final HtmlPage page = webClient.getPage "https://www.linkedin.com/secure/login"); final HtmlForm form = page.getForms().get(0); final HtmlSubmitInput button = form.getInputByName("signin"); final HtmlTextInput emailBtn = form.getInputByName("session_key"

HtmlUnit doubts regarding cookies and windows

China☆狼群 提交于 2019-12-23 05:32:50
问题 If the HtmlUnit stores cookies in memory then Will HtmlUnit respond the server with cookies? When the HtmlUnit session terminates? Will it terminate when i call webclient.closeWindow()? As acc. to the HtmlUnit docs, WebClient represents a browser, so Is it represent a mutiple-windows browser (like IE7 in which we can open multiple tabs) or represen a single-window browser? If it represents a multiple-window browser, then does the HttpSession is maintained accross multiple windows of that

Actions and htmlunitdriver - speed issue

╄→гoц情女王★ 提交于 2019-12-23 04:24:16
问题 My web application has menus that open on MouseOver. I'm writing tests using htmlunitdriver. Test code to trigger menu is Actions builder = new Actions(driver); WebElement menu = driver.findElement(By.xpath("//a[starts-with(@href,'/index.html')]")); Thread.sleep(2000); builder.moveToElement(menu).build().perform(); Thread.sleep(2000); driver.findElement(By.xpath("//a[starts-with(@href,'/submenuitem')]")).click(); driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); When I run a

unable to run Htmlunit application using Maven dependency

左心房为你撑大大i 提交于 2019-12-23 03:00:12
问题 I have added Htmlunit Maven dependency by adding the following to my pom.xml <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> <version>2.18</version> </dependency> When I am trying to run the application, I am getting the following error: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/NoopHostnameVerifier at com.gargoylesoftware.htmlunit.httpclient.HtmlUnitSSLConnectionSocketFactory.buildSSLSocketFactory

How do I make my AJAX content crawlable by Google?

会有一股神秘感。 提交于 2019-12-23 02:17:17
问题 I've been working on a site that uses jQuery heavily and loads in content via AJAX like so: $('#newPageWrapper').load(newPath + ' .pageWrapper', function() { //on load logic } It has now come to my attention that Google won't index any dynamically loaded content via Javascript and so I've been looking for a solution to the problem. I've read through Google's Making AJAX Applications Crawlable document what seems like 100 times and I still don't understand how to implement it (due in the most

TDD的JavaScript单元测试工具

一个人想着一个人 提交于 2019-12-22 20:39:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我研究并考虑了许多JavaScript单元测试和测试工具,但一直无法找到合适的选项来保持与TDD的完全兼容。 那么,是否有一个完全符合TDD的JavaScript单元测试工具? #1楼 看一下 Dojo对象线束(DOH)单元测试框架 ,它是JavaScript单元测试的几乎与框架无关的工具,并且没有任何Dojo依赖项。 使用Dojo Objective Harness对Web 2.0应用程序进行单元测试时 ,对此有很好的描述。 如果要自动化UI测试(许多开发人员的 苦恼 ),请查看 doh.robot (临时向下更新:其他链接 http://dojotoolkit.org/reference-guide/util/dohrobot.html ) 和 dijit .robotx (暂时关闭) 。 后者专为验收测试而设计。 更新: 引用的文章介绍了如何使用它们,如何模拟用户使用鼠标和/或键盘与UI交互以及如何记录测试会话,以便以后可以自动“播放”它。 #2楼 作为专家,您可以“在实际的浏览器上运行”,但是根据我的经验,这是一个缺点,因为它运行缓慢。 但是,使之具有价值的是非浏览器替代品缺乏足够的JS仿真。 如果您的JS非常复杂,以至于仅在浏览器中进行测试就足够了,但是还可以考虑以下两个选项: HtmlUnit :

How can I test context menu functionality in a web app?

我怕爱的太早我们不能终老 提交于 2019-12-22 08:46:16
问题 I'm playing with a grails app that has a contextmenu (on right-click). The context menu is built using Chris Domigan's jquery contextmenu plugin. While the contextmenus do actually work, I want to have automated tests, and I can't work out how to do it. I've tried Selenium 2.05a (ie. Webdriver), but there's no rightClick method. I notice that HtmlUnit has a rightclick method, but I don't seem to be able to detect any difference in the DOM between before the click and after it. 回答1: Currently

How to see the DOM generated by javascript using htmlunit?

橙三吉。 提交于 2019-12-22 06:58:58
问题 I have got an html page in which the UI is generated using javascript.I am interested in a form which is visible when the page is inspected using developer tools but not in html source. In htmlunit i tried to wait for the javascript to execute and then print it as Xml but DOM elements are not seen!!How can i do this??Please help 回答1: HtmlPage.getDocumentElement().asXml() This can be tested using System.out.println(page.getDocumentElement().asXml()); on <html> <body> <div id="lj"> </div>

Is it possible to use HTTPS proxy in HTMLunit?

醉酒当歌 提交于 2019-12-22 06:33:57
问题 I am new in HTMLunit and trying to set HTTPS proxy for HTMLunit. I tried to use https:// just before the HOST IP, but I got Exception. Anyone can help me to solve this issue? Update: My Code is: WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3_6,"https://199.127.100.13", 11888); Update 2: I asked the developer team, The said that it is a bug in the framework. They will fix it. 回答1: You should not be putting http:// or https:// behind the ip address of the proxy server. If your

HtmlUnit download file

烈酒焚心 提交于 2019-12-21 20:50:16
问题 I am trying to download file via HTMLUnit. But every time when I use code like this: InputStream stream = anchor.click().getWebResponse().getContentAsStream(); i get website instead file. Download link looks like this: <a id="j_id272:exportToExcel" onclick="if(typeof jsfcljs == 'function'){jsfcljs(document.forms['j_id272'],'j_id272:exportToExcel,j_id272:exportToExcel','');}return false" href="#"> <img id="j_id272:exportToExcelImage" alt="???exportToExcel???" src="/ECRM/gfx/icon_excel.gif"> <