My goal is simple : I have a page with cufon titles.
And I have a bookmarklet script to change all text on a page in lorem ipsum automatically.
But cufon text is not transformed.
Can I change cufon text with developer tool in chrome browser or other ?
I have tried with console to run a command like :
Cufon.reload();
or
Cufon.refresh();
But that doesn't work.
Someone can help me ?
I have found the solution :
First : replace alt attribute of the cufon tag.
<cufon class="cufon cufon-canvas" alt="Home"
to :
<cufon class="cufon cufon-canvas" alt="Lorem"
Second execute in console :
Cufon.replace('.menu-item a');
in my case. (to be applicate for each element to replace)
Related
I have a python script that opens a website with selenium .
After opening I want selenium to change some lines in html of some button in the website.
This is the actual code when I inspect the page with chrome dev tools
<button type="button" class="achieve-btn">Sometext & Sometext</button>
this is what I want to modify code with it
<button type="button" class="getExamButtonId1" onclick="openInstructionsPage(6012,'getExamButtonId1','incompleteExamId10001861')">Sometext & Sometext</button>
is it possible or not?
And if this is possible please provide the exact line of code to write in my script to do the following.
Yes it is possible with JS intervention :
Also I am assuming, that this css button[class='achieve-btn'] is unique in DOM.
element = driver.find_element_by_css_selector("button[class='achieve-btn']");
driver.execute_script("arguments[0].setAttribute('class', 'getExamButtonId1')", element);
similarly I would suggest to pass onclick attribute
You need to try and modify the innerHTML property for this element.
element = driver.find_element_by_css_selector("button.achieve-btn")
driver.execute_script("arguments[0].innerHTML = 'your_html_code_here'", element)
I just got a problem using revolution slider in modx evolution.
My slider have jquery code
tabs: {
tmp:'<div class="tp-tab-content"> <span class="tp-tab-date">{{param1}}</span> <span class="tp-tab-title">{{title}}</span></div><div class="tp-tab-image"></div>'}
and modx of course parsing {{param1}} and {{title}} as chunks, but its part of revoslider's jquery.
so after parsign page html code looks like this
tabs: {
tmp:'<div class="tp-tab-content"> <span class="tp-tab-date"></span> <span class="tp-tab-title"></span></div><div class="tp-tab-image"></div>'}
and revolution slider shows incorrect
i tried calling revoslider code from html file using snipnet with php funtion include, but it also got parsed by modx engine
can i solve this problem without changing revoslider jquery code?
thanks to your ansewers!
I am not an EVO expert, but I could suggest several tricks that may help:
Try to escape the curly braces like \{\{param1\}\}
Try to breake the sequence like {[*fakeTemplateVar*]{param1}[*fakeTemplateVar*]}*
Try an empty TV like [*fakeTemplateVar*:ifempty={{param1}}]
*fakeTemplateVar will finally evaluate to an empty place in the template.
I have this code in a file .jade :
iframe(src="file2.jade" width='100%' height='4000' frameborder=0 scrolling='no')
the file2 file is in the same folder as this file, but does not insert the file, what can I do?.
Thanks
Adding .jade file to an iframe does not make sense. Iframes are processed by a browser, and browser expects html, not jade.
So the answer depends on what are you trying to do, maybe include directive will help.
Add one more empty line above iframe tag code with the same space (or tab), . character is display for a space or tab I mention above.
article
..p Some text here (2 space after article block)
.. <--- An empty line with 2 space tab before iframe tag
..iframe(width='560', height='315', src='//www.youtube.com/embed/KpuDq9HyLeg', frameborder='0')
It's means have 1 more line above iframe tag with the same space (tab) and inside parent tag of iframe.
It's work for me. Hope this help!
On a webpage (which I cannot change) I have a link like this:
<a class="PSHYPERLINK" href="javascript:submitAction_win0(document.win0,'PRCSDETAIL_BTN$0');" tabindex="94" id="PRCSDETAIL_BTN$0" name="PRCSDETAIL_BTN$0"> Details</a>
In my code, I put this:
browser.frame(:index, "1" ).link( :text => "Details" ).click
What happens is that the link is not clicked, or at least this makes no effect, but I receive no error. The script simply continues. It is interesting that on the same website I am able to click other links, even if they use JavaScript like the one above. Example of link for which FireWatir works:
<a class="PSSRCHRESULTSODDROW" tabindex="32" href="javascript:submitAction_win0(document.win0,'#ICRow2');">TESTQUERY</a>
Maybe you need to fire JavaScript event: How to find out which JavaScript events fired?
Are you sure you are clicking the correct link? Link text is " Details" and you are clicking link with text "Details" (please notice space in front of the first string).
Given the following HTML code (which, I realise, sucks, but that's not something I can currently solve):
<img height="64" width="64" class='list_item' src="/img/icon/first.jpg"
title="This is the first item::Completed the item "I did this first"" alt="First" />
gives me a result of (this is an image.to_s)
name:
type:
id:
value:
disabled:
src: /img/icon/first.jpg
width: 64
height: 64
alt: First
Note lack of "title" element. This does not actually change (the lack of the title element)
If I get the contents of the parent div of one of those icons, I get something like:
<img class="list_item" I="" did="" this="" first="" src="/img/icon/first.jpg" alt="First">
The broken HTML of the original has been turned into separate attributes somewhere down the line, but the title tag appears to have been stripped completely, and since it's the contents of the title tag I need, I'm a little stuck.
This has been tried with lastest Watir on Ruby 1.9.2 using Firefox.
Perfect world solution: I'd like to get the original transmitted HTML for the image tag, so I can "special case" (ie, hack) around the stupid double-quote problem.
Good Enough Solution: the contents of the title tag.
There is actually a #title method on Watir::Image. With the above incorrect HTML the output would be like this (where 'i' is the Image object):
i.title
=> "This is the first item::Completed the item "
This shows only part of the title.
But you could use #html and then parse all the necessary information out of it with some magic:
i.html
=> "<IMG class=list_item title=\"This is the first item::Completed the item \" alt=First src=\"/img/icon/first.jpg\" width=64 height=64 first?? this did I>"
But as other answers above have mentioned - you cannot get it out correctly due to the bad HTML. Maybe there's some other way to accomplish your bigger goal you're having?
getting the title probably isn't working because the way the title attribute is set on that element isn't valid. entities " and < and > need to be escaped inside html attributes, with " and < and > respectively. Escape the quotes and try again.
Not sure, but I don't think Watir supports image titles. I looked over the Supported Elements page, title was x'ed out. I don't see it in the RDoc for Watir::Image type either.