Anyone good with Selenium? Please PM me!

Hav3n

New member
Mar 19, 2010
1,849
37
0
GA
Hey guys,

I've got a project in Selenium where I want to automate blog posts but I can't get Selenium to select and write too the RTE/WYSIWYG editor.

Been trying selectFrame and it just isn't getting there.

Can someone help me out? I'll figure out something to give in return!

PM me for the specifics.

Thanks!
 


In order to help I'd need to know the site and see some code. It could very well be an iframe issue. I ditched Selenium a while back in favor of actually embedding browser engines inside of my stuff. It's all C++ though so that might not be an option for you.
 
I dealt with this when botting with Watir a few years back. You need to do some funky shit to interact with the iframe essentially. Here's some Ruby Watir code for BlogsBlogs (I make no guarantees this works at all anymore, and it's from a much larger codebase anyways and is about two years old, so...yeah):

#accepts spun article hash, returns posted entry url
def postArticle(article)

puts " "
puts "Posting article to Blogs-Blogs"
puts "*******************************"

@browser.goto("http://www.blogs-blogs.com/manager/index.php")

@browser.link(:text, "new entry").click

puts "Entering Title"
@browser.text_field(:name, "title").set(article["title"])

puts "Capturing the stupid fucking popup"
popup = @browser.link(:id, "mce_editor_0_code").click_and_attach

puts "Entering body"
popup.text_field(:xpath, ".//*[@id='htmlSource']").set(article['body'])

puts "Clicking Update"
popup.button(:xpath, ".//*[@id='insert']").click

puts "Chilling for a few seconds"
sleep(3)

@browser.button(:value,"Add New Entry").click

puts "Article Successfully Posted"

@browser.goto("http://#{@account[1]}.blogs-blogs.com")
puts "Visiting Blog To Scrape New URL"

page_html = Nokogiri::HTML.parse(@browser.html)

entry_url = ''

#scrape the url of the new post
page_html.xpath(".//a[text()='Link']").each do |link|
entry_url = link.attribute('href')
break
end

puts "Entry URL Successfully Scraped"

return entry_url

end
 
yeah. if i had my choice it'd be no problem.

but in this particular instance I am limited to the Selenium IDE. fuuuuuuuuuuuuu
 
Posting this here in case it helps people in the future.

Okay, I figured out a way that you can do it from within the Selenium IDE.

The command is:
Code:
runScript
The target is:
Code:
window.document.getElementById('yourID').contentDocument.activeElement.innerHTML  = 'Put your content here.'
The value can be whatever.

The issue with the WYSIWYG editor is that it's inside an iframe, and Selenium switching between iframes doesn't work very well. I tried to do it with Web Driver, but then I realized I could help the OP more by using JS to make it work from the Selenium IDE.

Hope this helps!