Skip to content

Instantly share code, notes, and snippets.

View prashanth-sams's full-sized avatar
🍎
Each day is interesting!!!

Prashanth Sams prashanth-sams

🍎
Each day is interesting!!!
View GitHub Profile
@prashanth-sams
prashanth-sams / ruby_selenium_methods.rb
Created July 9, 2017 09:04
generic selenium methods
def wait_for_ajax(timeout = 60, message = nil)
wait_for_jquery(timeout / 2, message)
super(timeout / 2, message)
end
def wait_for_jquery(timeout = 30, message = nil)
end_time = ::Time.now + timeout
until ::Time.now > end_time
begin
return if @browser.execute_script('return jQuery ? 1 : 0;') == 1
@prashanth-sams
prashanth-sams / Ruby_Selenium_Cheatsheet.md
Last active August 7, 2017 13:43
Ruby Selenium Cheatsheet

screenshot

@driver.save_screenshot('./screenshot.png')

re-use basic auth credentials in Firefox without prompting again and again

profile = Selenium::WebDriver::Firefox::Profile.new
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@prashanth-sams
prashanth-sams / map.json
Created July 24, 2017 07:27 — forked from ketanghumatkar/map.json
Leaflet MAP json sample
[
{
"_id":"577e9a7e664bdcee93000000",
"average_attendance":90,
"batch_code":"LALS010156",
"batch_id":"20160707T1807580000",
"batch_name":"LKSLST01/02/",
"batch_number":156,
"batch_pass_percentage":100,
"candidate_assessed":124,
Given /I click_on "(.*)" "(.*)"/ do |value, type|
steps %Q{
And I wait until "#{value}" "#{type}" renders
}
@driver.find_element(type.to_sym => value).click
end
When /I wait for "(.*)" "(.*)" to render/ do |what, how|
start_time = Time.now.to_i
wait = Selenium::WebDriver::Wait.new(:timeout => 60)
Given /I click_on "(.*)" "(.*)"/ do |value, type|
steps %Q{
And I wait until "#{value}" "#{type}" renders
}
@driver.find_element(type.to_sym => value).click
end
When /I wait for "(.*)" "(.*)" to render/ do |what, how|
start_time = Time.now.to_i
wait = Selenium::WebDriver::Wait.new(:timeout => 60)

Switching Linux Cmd Mode

Ctrl + Alt + F5

see list of usernames

cat /etc/passwd

ignorecase

grep -i

@prashanth-sams
prashanth-sams / api.md
Last active August 29, 2017 12:27
Postman API

Response Body

{
  "data": {
    "type": "access_token",
    "id": "",
    "attributes": {
      "token_type": "Bearer",
 "access_token": "xxxxxxxxxxxxxxxxx"

5th minute of every one hour

5 * * * * 

Every 5 mins

*/5 * * * *
(function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {