xpath

How to use Xpath of button in Selenium RC?

心已入冬 提交于 2020-01-17 01:55:08
问题 I am working in Selenium RC. Can anyone please let me know how to write xpath for button in Selenium (Java)? 回答1: You should develop the script in the Selenium IDE (download) before porting it to Selenium RC. In Selenium IDE, when you click anything on the webpage, it should automatically generate some kind of selector for the element you clicked. Then, once you've recorded all the events, you Format it in whatever language you're using, and then you copy and paste it to your Selenium RC code

Scraping using Html Agility Package

怎甘沉沦 提交于 2020-01-17 01:42:05
问题 I am trying to scrape data from a news article using HtmlAgilityPackage the link is as follows http://www.ndtv.com/india-news/vyapam-scam-documents-show-chief-minister-shivraj-chouhan-delayed-probe-780528 I have written the following code below to extract all the comments in this articles but for some reason my variable aTags is returning null value Code: var getHtmlWeb = new HtmlWeb(); var document = getHtmlWeb.Load(txtinputurl.Text); var aTags = document.DocumentNode.SelectNodes("//div[

XPath processor output as string

一曲冷凌霜 提交于 2020-01-17 01:29:12
问题 Standard XPath processing in java with javax.xml.xpath works like this: I provide name for xml to process I provide xpath expression as a string. I gain answer stored as a list of nodes, or eventually as a single value depending on what type of output I select. I need to write a couple of tests in java which basically should work like this: I provide xpath expression as a string and it checks if xpath output of this expression equals to some specified output(also provided as string). So I

Xpath Predicate to match <![CDATA[sometext]]>

心已入冬 提交于 2020-01-17 01:19:20
问题 My xml element content is having special characters like <,>,[,]. I want to find element macthing the content <![CDATA[someText]]> and replace it with some new value like <![CDATA[newValue]]> . <property name="sourcePath"> <string><![CDATA[someText]]></string> </property>` I am trying to do this using below xsl template. But it is not working. <xsl:template match="property[string='<![CDATA[someText]]>']"> <xsl:element name="string"> <xsl:text disable-output-escaping="yes"><![CDATA[newValue]]>

Java+Selenium自动化测试(二)

烈酒焚心 提交于 2020-01-16 20:10:01
Java+Selenium+TestNG自动化测试框架整合 1、简化代码 封装一个定位元素的类,类型为ElementLocation package com.test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import java.util.concurrent.TimeUnit; /** * 每次定位元素都调用相同的方法 * 将每个方法都封装起来仅供调用 */ public class ElementLocation { /** * 通过id定位元素 * @param id * @param elementId */ public void finElementByID(String id, String elementId, WebDriver driver){ driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.ById.id(id)).sendKeys(elementId); } /** * 通过xpath定位元素 * @param xpath * @param text */ public void findElementByXpath(String

Xpath: Select node from within document node variable for each loop

故事扮演 提交于 2020-01-16 19:21:05
问题 I came across an expected problem and I am wondering whether there's a solution better than mine. So, I have a document node variable: <xsl:variable name="variableNode" as="document-node()"> <xsl:document> <root> <element>...content...</element> <root> </xsl:document> </xsl:variable> The content of this document node variable is processed later by a for-each loop: <xsl:for-each select="$variableNode/root/element"> ...content... </xsl:for-each> From within the content of this for-each loop I

Xmlpoke to add multiple appsettings key doesn't work

亡梦爱人 提交于 2020-01-16 19:12:13
问题 I have a Msbuild target that gets executed successfully by adding a single key called 'ProjectID' to the appsetting section of web.config. Now am changing the behavior of this target by adding one more key 'ApplicationId' to the same appsetting section. The log shows the xmlpoke is executed for both. But only the projectID value is correctly replaced with every run. (Excerpt from)PropertyGroup definition: <?xml version="1.0" encoding="utf-8" ?> <Project ToolsVersion="15.0" DefaultTargets=

Asserting the background image of a page with selenium

妖精的绣舞 提交于 2020-01-16 18:26:32
问题 I have an app in which the user can change the background image of their profile page. Therefore, I wasnt to assert that, when the user changes the image, the image actually changes. I can't for the life of me figure out a css selector or xpath to do the job. This is the HTML I have: <body style="background:#FFFFFF url(/uploads/images/000/000/002/original.png?1257966819) no-repeat 0 0;" class="users users-show-edit layout-main-with-sidebar" id="users-edit"> Any sugestions? 回答1: I've used the

Dynamically evaluate XPath stored in a variable

风格不统一 提交于 2020-01-16 18:00:24
问题 I have a variable: <xf:var name="xpath" value="/my/xpath/expression"/> and I want to use /my/xpath/expression in the ref attribute of <xf:input> : <xf:input ref="/my/xpath/expression"/> Here I use a hardcoded XPath expression, but I want instead to use the XPath expression stored in the $xpath variable instead, something like this : <xf:input ref="$xpath"/> How can this be achieved? 回答1: What you probably mean is that the value of $xpath is a string, literal or not, which you then want to

Rename XML files with VBScript, using XPath

穿精又带淫゛_ 提交于 2020-01-16 13:05:31
问题 I've got a VBScript that renames XML files in a directory, based on nodes values present on these XMLs. These files need to be renamed with a "Operadora" name and a "Date". "Operadora" is an unique node, but there are several "Date" nodes on my XMLs, so I need to take the most recent "Date" as part of the file name. A friend in StackOverflow helped me out finding a way to do it to one archive, but I'm getting an error implementing it when it's about to read multiple files. I'm getting an