How to use Feed_Xpath module in drupal? - xpath

I was trying to fetch the Dspace conetent into Drupal.
I found a way .I have RestFulWebServices(Xmls) with me.
I have installed Feed Xpath module in Drupal7.
I have given Import Url as " http://library.leadingtochoices.org/dspace-rest-1.8.1/collections.xml "
and As Xpath Parser Setting :
Contecxt : /collections
Title : /collection
body :/communities/name
it will came with whole xml not the queired one.
I want to know only the name Attribute ,but it came with whole file.
Please let me know how to use Feed Xpath module.
Thanks,

Try this.
Context : //collection
Title : body
Body : name

Related

IllegalArgument Exception : Unable to compile

I am getting IlleagalArgument Exception while retreiving Xpath for a particular node
I need to retrieve the below webpage link which follows the title WebPages ,I tried using the below expression but it is not able compile (Please see the comment section for the html )
page.getNode("//h3[. = 'Webpages:']/following-sibling::/ul[#class='list-entity-locations']/li/a/text()")
This is what I tried but got Exception
java.lang.IllegalArgumentException: Unable to compile
The right syntax is following-sibling::ul, not following-sibling::/ul.
To looking into html which you have posted there is no : text inside <h3>...</h3> tag.
Try the below code.
//h3[. = 'Webpages']/following-sibling::ul[#class='list-entity-locations']/li/a/text()

“Error no label add or removes specified” when trying to modify labels using Gmail's Ruby API

I've looked at https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/GmailV1/ModifyThreadRequest and the examples https://developers.google.com/gmail/api/v1/reference/users/labels/update for Python and JS but can't figure out how to format the request properly in ruby.
I'm trying:
service.modify_thread('me',thread_id,{'add_label_ids'=>['UNREAD']})
and various other permutations of the object but can't get anything other than Google::Apis::ClientError: invalidArgument: No label add or removes specified in response.
Any help appreciated
modify_thread expects a Google::Apis::GmailV1::ModifyThreadRequest object as third argument according to the documentation.
In the source of the constructor of ModifyThreadRequest you can see that it looks for a key :add_label_ids in its arguments.
So if modify_thread creates the ModifyThreadRequest object itself then
service.modify_thread('me',thread_id, add_label_ids: ['UNREAD'])
should work.
If that fails I would try
mtr = Google::Apis::GmailV1::ModifyThreadRequest.new(add_label_ids: ['UNREAD'])
service.modify_thread('me', thread_id, mtr)

HP UFT - WebElement cannot be found even after using correct xpath

I am new to UFT. I have a long "complex" xpath that finds precisely one element in chrome browser developer tools. When I use the same xpath in uft, the tool complains that the xpath is not in the object repository. Why does this happen and how do I fix it ?
This is what the xpath looks like:
//div[#class='a b c']//div[#class='p-q r-s']//div[#class='m n']//button[contains(text(), 'yes')]
I have to use such complex xpath because there are no ID attributes in this part of the page or any other 1-2 attributes which can uniquely identify the element.
Please help.
EDIT: My Vbscript code looks similar to this code:
Dim aButtonLoc
aButtonLoc = "//div[#class='a-b c-d-e g']" & _
"//div[#class='p-q r-s-t']//div[#class='uv w-x']" & _
"//button[contains(text(), 'Yes')]"
Error message: The {full xpath here} object was not found in the Object Repository. Check the Object Repository to confirm that the object exists or to find the correct name for the object.
There is an error in my aButtonLoc locator. It should have xpath mentioned, like this: aButtonLoc = "xpath:=//d...etc."

get the frontend theme path in magento admin

In my Magento module i upload a CSS file in the backend to use it in my front
I tried this :
Mage::getSingleton('core/design_package')->getSkinBaseDir()
But it gives different path (admin/front)
In my Block , I got this :
C:\wamp\www\ce_1.6.2.0\skin\frontend\default\default\
And in my Adminhtml/Controller (saving the file) I got this :
C:\wamp\www\ce_1.6.2.0\skin\adminhtml\default\default
How can I get the same path (front) in the Block and in the Controller ?
Thanks
just force it to the frontend :
Mage::getSingleton('core/design_package')->getSkinBaseDir(array('_area' => 'frontend'))
I'd like to offer and alternative to Rastaking's answer that will return a URL path rather than a file path:
Mage::getModel('core/design_package')->getSkinUrl();
This will return something like:
http://www.yourdomain.com/skin/frontend/your_package/your_skin/
Hope this helps, anyone looking for a similar solution.
You can try this:
Mage::getSingleton('core/design_package')->getSkinBaseDir(array('_area' => 'frontend','_package'=>'rwd','_theme'=>'default'));

Selenium WebDriver issue with By.cssSelector

I have an element whose html is like :
<div class="gwt-Label textNoStyle textNoWrap titlePanelGrayDiagonal-Text">Announcements</div>
I want to check the presence of this element. So I am doing something like :
WebDriver driver = new FirefoxDriver(profile);
driver.findElement(By.cssSelector(".titlePanelGrayDiagonal-Text"));
But its not able to evaluate the CSSSelector.
Even I tried like :
By.cssSelector("gwt-Label.textNoStyle.textNoWrap.titlePanelGrayDiagonal-Text")
tried with this as well :
By.cssSelector("div.textNoWrap.titlePanelGrayDiagonal-Text")
Note : titlePanelGrayDiagonal-Text class is used by only this element in the whole page. So its unique.
Contains pseudo selector I can not use.
I want to identify only with css class.
Versions: Selenium 2.9 WebDriver
Firefox 5.0
When using Webdriver you want to use W3C standard css selectors not sizzle selectors like you may be used to using in jquery. In your example you would want to use:
driver.findElement(By.cssSelector("div[class='titlePanelGrayDiagonal-Text']"));
From reading over your post what you should do since that class is unique is just do a FindElement(By.ClassName("titlePanelGrayDiagonal-Text"));
Also the CssSelector doesn't handle the contains keyword it was something that the w3 talked about but never added.
I haven't used css selectors, but this is the xpath selector I would use:
"xpath=//div[#class='gwt-Label textNoStyle textNoWrap titlePanelGrayDiagonal-Text']"
The css selector should then probably be something like
"css=div[class='gwt-Label textNoStyle textNoWrap titlePanelGrayDiagonal-Text']"
Source: http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/dotnet/Selenium.html
Did you ever tried following code,
By.cssSelector("div#gwt-Label.textNoStyle.textNoWrap.titlePanelGrayDiagonal-Text");
I believe using a wildcard in CSS would be more helpful. Something as follows
driver.findElement(By.cssSelector("div[class$='titlePanelGrayDiagonal-Text']");
This will look into the class attribute and see what that attribute is ending with. Since your class attribute is ending with "titlePanelGrayDiagonal-Text" string, the added '$' in the css statement will find the element and then you can perform whatever action you're trying to perform.

Resources