Tuesday, March 25, 2014

Remove attribute from html using javascript, webdriver, python

EXAMPLE:
<tag id="id" name="name" class="class" readonly="readonly">EXAMPLE</tag>

self.find_elem_by_id("id").get_attribute("innerHTML") => EXAMPLE
self.find_elem_by_id("id").get_attribute("outerHTML") => <tag id="id" name="name" class="class" readonly="readonly">EXAMPLE</tag>

self.driver.execute_script('document.getElementById("id").removeAttribute("readonly")') => <tag id="id" name="name" class="class">EXAMPLE</tag>

Wednesday, March 12, 2014

Install PhantomJS

http://phantomjs.org/download -> phantomjs-1.9.7-linux-x86_64.tar.bz2
cd /usr/local/share/

sudo tar jxvf phantomjs-1.9.7-linux-x86_64.tar.bz2
sudo ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/ /usr/local/share/phantomjs
sudo ln -s /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin/phantomjs