How to use enabled method of Selenium.WebDriver Package

Best Selenium code snippet using Selenium.WebDriver.enabled

selenium-webdriver.rbi

Source:selenium-webdriver.rbi Github

copy

Full Screen

...718 def clear; end719 def click; end720 def css_value(prop); end721 def displayed?; end722 def enabled?; end723 def eql?(other); end724 def first(*args); end725 def hash; end726 def initialize(bridge, id); end727 def inspect; end728 def location; end729 def location_once_scrolled_into_view; end730 def property(name); end731 def rect; end732 def ref; end733 def selectable?; end734 def selected?; end735 def send_key(*args); end736 def send_keys(*args); end737 def size; end738 def style(prop); end739 def submit; end740 def tag_name; end741 def text; end742 def to_json(*arg0); end743 include Selenium::WebDriver::SearchContext744end745module Selenium::WebDriver::Atoms746 def execute_atom(function_name, *arguments); end747 def read_atom(function); end748end749class Selenium::WebDriver::Point < Struct750 def self.[](*arg0); end751 def self.inspect; end752 def self.members; end753 def self.new(*arg0); end754 def x; end755 def x=(_); end756 def y; end757 def y=(_); end758end759class Selenium::WebDriver::Dimension < Struct760 def height; end761 def height=(_); end762 def self.[](*arg0); end763 def self.inspect; end764 def self.members; end765 def self.new(*arg0); end766 def width; end767 def width=(_); end768end769class Selenium::WebDriver::Rectangle < Struct770 def height; end771 def height=(_); end772 def self.[](*arg0); end773 def self.inspect; end774 def self.members; end775 def self.new(*arg0); end776 def width; end777 def width=(_); end778 def x; end779 def x=(_); end780 def y; end781 def y=(_); end782end783class Selenium::WebDriver::Location < Struct784 def altitude; end785 def altitude=(_); end786 def latitude; end787 def latitude=(_); end788 def longitude; end789 def longitude=(_); end790 def self.[](*arg0); end791 def self.inspect; end792 def self.members; end793 def self.new(*arg0); end794end795module Selenium::WebDriver::Chrome796 def self.driver_path; end797 def self.driver_path=(path); end798 def self.path; end799 def self.path=(path); end800end801module Selenium::WebDriver::Chrome::Bridge802 def available_log_types; end803 def commands(command); end804 def log(type); end805 def network_conditions; end806 def network_conditions=(conditions); end807 def send_command(command_params); end808end809class Selenium::WebDriver::Chrome::Driver < Selenium::WebDriver::Driver810 def browser; end811 def create_capabilities(opts); end812 def execute_cdp(cmd, **params); end813 def initialize(opts = nil); end814 def quit; end815 include Selenium::WebDriver::DriverExtensions::DownloadsFiles816 include Selenium::WebDriver::DriverExtensions::HasLocation817 include Selenium::WebDriver::DriverExtensions::HasNetworkConditions818 include Selenium::WebDriver::DriverExtensions::HasTouchScreen819 include Selenium::WebDriver::DriverExtensions::HasWebStorage820 include Selenium::WebDriver::DriverExtensions::TakesScreenshot821end822class Selenium::WebDriver::Chrome::Profile823 def [](key); end824 def []=(key, value); end825 def add_encoded_extension(encoded); end826 def add_extension(path); end827 def as_json(*arg0); end828 def directory; end829 def initialize(model = nil); end830 def layout_on_disk; end831 def prefs; end832 def prefs_file_for(dir); end833 def read_model_prefs; end834 def write_prefs_to(dir); end835 extend Selenium::WebDriver::ProfileHelper::ClassMethods836 include Selenium::WebDriver::ProfileHelper837end838class Selenium::WebDriver::Chrome::Options < Selenium::WebDriver::Common::Options839 def add_argument(arg); end840 def add_emulation(device_name: nil, device_metrics: nil, user_agent: nil); end841 def add_encoded_extension(encoded); end842 def add_extension(path); end843 def add_option(name, value); end844 def add_preference(name, value); end845 def args; end846 def as_json(*arg0); end847 def binary; end848 def binary=(arg0); end849 def detach; end850 def detach=(arg0); end851 def emulation; end852 def encoded_extensions; end853 def extensions; end854 def headless!; end855 def initialize(**opts); end856 def options; end857 def prefs; end858 def profile; end859 def profile=(arg0); end860end861class Selenium::WebDriver::Chrome::Service < Selenium::WebDriver::Service862 def extract_service_args(driver_opts); end863 def self.driver_path=(path); end864end865module Selenium::WebDriver::Edge866 def self.driver_path; end867 def self.driver_path=(path); end868end869module Selenium::WebDriver::Edge::Bridge870 def commands(command); end871 def maximize_window(handle = nil); end872 def reposition_window(x, y, handle = nil); end873 def resize_window(width, height, handle = nil); end874 def send_keys_to_active_element(key); end875 def window_handle; end876 def window_position(handle = nil); end877 def window_size(handle = nil); end878end879class Selenium::WebDriver::Edge::Driver < Selenium::WebDriver::Driver880 def browser; end881 def initialize(opts = nil); end882 def quit; end883 include Selenium::WebDriver::DriverExtensions::TakesScreenshot884end885class Selenium::WebDriver::Edge::Options886 def add_extension_path(path); end887 def as_json(*arg0); end888 def extension_paths; end889 def in_private; end890 def in_private=(arg0); end891 def initialize(**opts); end892 def start_page; end893 def start_page=(arg0); end894end895class Selenium::WebDriver::Edge::Service < Selenium::WebDriver::Service896 def extract_service_args(driver_opts); end897end898module Selenium::WebDriver::Firefox899 def self.driver_path; end900 def self.driver_path=(path); end901 def self.path=(path); end902end903module Selenium::WebDriver::Firefox::Driver904 def self.marionette?(opts); end905 def self.new(**opts); end906end907module Selenium::WebDriver::Firefox::Util908 def app_data_path; end909 def self.app_data_path; end910 def self.stringified?(str); end911 def stringified?(str); end912end913class Selenium::WebDriver::Firefox::Extension914 def create_root; end915 def initialize(path); end916 def read_id(directory); end917 def read_id_from_install_rdf(directory); end918 def read_id_from_manifest_json(directory); end919 def write_to(extensions_dir); end920end921class Selenium::WebDriver::Firefox::Binary922 def execute(*extra_args); end923 def modify_link_library_path(profile_path); end924 def quit; end925 def self.macosx_path; end926 def self.path; end927 def self.path=(path); end928 def self.reset_path!; end929 def self.version; end930 def self.windows_path; end931 def self.windows_registry_path; end932 def start_with(profile, profile_path, *args); end933 def wait; end934end935class Selenium::WebDriver::Firefox::ProfilesIni936 def [](name); end937 def initialize; end938 def parse; end939 def path_for(name, is_relative, path); end940 def refresh; end941end942class Selenium::WebDriver::Firefox::Profile943 def []=(key, value); end944 def add_extension(path, name = nil); end945 def add_webdriver_extension; end946 def assume_untrusted_certificate_issuer=(bool); end947 def assume_untrusted_certificate_issuer?; end948 def delete_extensions_cache(directory); end949 def delete_lock_files(directory); end950 def encoded; end951 def extension_name_for(path); end952 def initialize(model = nil); end953 def install_extensions(directory); end954 def layout_on_disk; end955 def load_no_focus_lib=(arg0); end956 def load_no_focus_lib?; end957 def log_file; end958 def log_file=(file); end959 def name; end960 def native_events=(arg0); end961 def native_events?; end962 def port=(port); end963 def proxy=(proxy); end964 def read_model_prefs; end965 def read_user_prefs(path); end966 def secure_ssl=(arg0); end967 def secure_ssl?; end968 def self.default_preferences; end969 def self.from_name(name); end970 def self.ini; end971 def set_manual_proxy_preference(key, value); end972 def update_user_prefs_in(directory); end973 def write_prefs(prefs, path); end974 extend Selenium::WebDriver::ProfileHelper::ClassMethods975 include Selenium::WebDriver::ProfileHelper976end977class Selenium::WebDriver::Firefox::Launcher978 def assert_profile; end979 def connect_until_stable; end980 def create_profile; end981 def fetch_profile; end982 def find_free_port; end983 def initialize(binary, port, profile = nil); end984 def launch; end985 def quit; end986 def socket_lock; end987 def start; end988 def url; end989end990module Selenium::WebDriver::Firefox::Legacy991end992class Selenium::WebDriver::Firefox::Legacy::Driver < Selenium::WebDriver::Driver993 def browser; end994 def initialize(opts = nil); end995 def quit; end996 include Selenium::WebDriver::DriverExtensions::TakesScreenshot997end998module Selenium::WebDriver::Firefox::Marionette999end1000module Selenium::WebDriver::Firefox::Marionette::Bridge1001 def commands(command); end1002 def install_addon(path, temporary); end1003 def uninstall_addon(id); end1004end1005class Selenium::WebDriver::Firefox::Marionette::Driver < Selenium::WebDriver::Driver1006 def browser; end1007 def create_capabilities(opts); end1008 def initialize(opts = nil); end1009 def quit; end1010 include Selenium::WebDriver::DriverExtensions::HasAddons1011 include Selenium::WebDriver::DriverExtensions::HasWebStorage1012 include Selenium::WebDriver::DriverExtensions::TakesScreenshot1013end1014class Selenium::WebDriver::Firefox::Options < Selenium::WebDriver::Common::Options1015 def add_argument(arg); end1016 def add_option(name, value); end1017 def add_preference(name, value); end1018 def args; end1019 def as_json(*arg0); end1020 def binary; end1021 def binary=(arg0); end1022 def headless!; end1023 def initialize(**opts); end1024 def log_level; end1025 def log_level=(arg0); end1026 def options; end1027 def prefs; end1028 def process_profile(profile); end1029 def profile; end1030 def profile=(profile); end1031end1032class Selenium::WebDriver::Firefox::Service < Selenium::WebDriver::Service1033 def extract_service_args(driver_opts); end1034end1035module Selenium::WebDriver::IE1036 def self.driver_path; end1037 def self.driver_path=(path); end1038end1039class Selenium::WebDriver::IE::Driver < Selenium::WebDriver::Driver1040 def browser; end1041 def create_capabilities(opts); end1042 def initialize(opts = nil); end1043 def quit; end1044 include Selenium::WebDriver::DriverExtensions::HasWebStorage1045 include Selenium::WebDriver::DriverExtensions::TakesScreenshot1046end1047class Selenium::WebDriver::IE::Options < Selenium::WebDriver::Common::Options1048 def add_argument(arg); end1049 def add_option(name, value); end1050 def args; end1051 def as_json(*arg0); end1052 def browser_attach_timeout; end1053 def browser_attach_timeout=(value); end1054 def element_scroll_behavior; end1055 def element_scroll_behavior=(value); end1056 def ensure_clean_session; end1057 def ensure_clean_session=(value); end1058 def file_upload_dialog_timeout; end1059 def file_upload_dialog_timeout=(value); end1060 def force_create_process_api; end1061 def force_create_process_api=(value); end1062 def force_shell_windows_api; end1063 def force_shell_windows_api=(value); end1064 def full_page_screenshot; end1065 def full_page_screenshot=(value); end1066 def ignore_protected_mode_settings; end1067 def ignore_protected_mode_settings=(value); end1068 def ignore_zoom_level; end1069 def ignore_zoom_level=(value); end1070 def initial_browser_url; end1071 def initial_browser_url=(value); end1072 def initialize(**opts); end1073 def native_events; end1074 def native_events=(value); end1075 def options; end1076 def persistent_hover; end1077 def persistent_hover=(value); end1078 def require_window_focus; end1079 def require_window_focus=(value); end1080 def use_per_process_proxy; end1081 def use_per_process_proxy=(value); end1082 def validate_cookie_document_type; end1083 def validate_cookie_document_type=(value); end1084end1085class Selenium::WebDriver::IE::Service < Selenium::WebDriver::Service1086 def extract_service_args(driver_opts); end1087end1088module Selenium::WebDriver::Remote1089end1090class Selenium::WebDriver::Remote::Bridge1091 def browser; end1092 def capabilities; end1093 def commands(command); end1094 def context; end1095 def context=(arg0); end1096 def create_session(desired_capabilities, options = nil); end1097 def dialect; end1098 def escaper; end1099 def execute(command, opts = nil, command_hash = nil); end1100 def file_detector; end1101 def file_detector=(arg0); end1102 def http; end1103 def http=(arg0); end1104 def initialize(opts = nil); end1105 def merged_capabilities(oss_capabilities, options = nil); end1106 def self.handshake(**opts); end1107 def session_id; end1108 include Selenium::WebDriver::Atoms1109 include Selenium::WebDriver::BridgeHelper1110end1111class Selenium::WebDriver::Remote::Driver < Selenium::WebDriver::Driver1112 def initialize(opts = nil); end1113 include Selenium::WebDriver::DriverExtensions::HasRemoteStatus1114 include Selenium::WebDriver::DriverExtensions::HasSessionId1115 include Selenium::WebDriver::DriverExtensions::HasWebStorage1116 include Selenium::WebDriver::DriverExtensions::Rotatable1117 include Selenium::WebDriver::DriverExtensions::TakesScreenshot1118 include Selenium::WebDriver::DriverExtensions::UploadsFiles1119end1120class Selenium::WebDriver::Remote::Response1121 def [](key); end1122 def add_backtrace(ex); end1123 def assert_ok; end1124 def backtrace_from_remote(server_trace); end1125 def code; end1126 def error; end1127 def error_message; end1128 def error_payload; end1129 def initialize(code, payload = nil); end1130 def payload; end1131 def payload=(arg0); end1132 def status; end1133 def value; end1134end1135class Selenium::WebDriver::Error::ServerError < StandardError1136 def initialize(response); end1137end1138module Selenium::WebDriver::Remote::Http1139end1140class Selenium::WebDriver::Remote::Http::Common1141 def call(verb, url, command_hash); end1142 def close; end1143 def create_response(code, body, content_type); end1144 def initialize; end1145 def quit_errors; end1146 def request(*arg0); end1147 def server_url; end1148 def server_url=(arg0); end1149 def timeout; end1150 def timeout=(arg0); end1151end1152class Selenium::WebDriver::Remote::Http::Default < Selenium::WebDriver::Remote::Http::Common1153 def close; end1154 def http; end1155 def initialize(open_timeout: nil, read_timeout: nil); end1156 def new_http_client; end1157 def new_request_for(verb, url, headers, payload); end1158 def open_timeout; end1159 def open_timeout=(arg0); end1160 def proxy; end1161 def proxy=(arg0); end1162 def read_timeout; end1163 def read_timeout=(arg0); end1164 def request(verb, url, headers, payload, redirects = nil); end1165 def response_for(request); end1166 def timeout=(value); end1167 def use_proxy?; end1168end1169class Selenium::WebDriver::Remote::Capabilities1170 def ==(other); end1171 def [](key); end1172 def []=(key, value); end1173 def as_json(*arg0); end1174 def browser_name; end1175 def browser_name=(value); end1176 def camel_case(str); end1177 def capabilities; end1178 def css_selectors_enabled; end1179 def css_selectors_enabled=(value); end1180 def css_selectors_enabled?; end1181 def eql?(other); end1182 def firefox_profile; end1183 def firefox_profile=(value); end1184 def initialize(opts = nil); end1185 def javascript_enabled; end1186 def javascript_enabled=(value); end1187 def javascript_enabled?; end1188 def merge!(other); end1189 def native_events; end1190 def native_events=(value); end1191 def native_events?; end1192 def platform; end1193 def platform=(value); end1194 def proxy; end1195 def proxy=(proxy); end1196 def rotatable; end1197 def rotatable=(value); end1198 def rotatable?; end1199 def self.chrome(opts = nil); end1200 def self.edge(opts = nil); end1201 def self.firefox(opts = nil); end1202 def self.firefox_legacy(opts = nil); end1203 def self.htmlunit(opts = nil); end1204 def self.htmlunitwithjs(opts = nil); end1205 def self.ie(opts = nil); end1206 def self.internet_explorer(opts = nil); end1207 def self.json_create(data); end1208 def self.phantomjs(opts = nil); end1209 def self.safari(opts = nil); end1210 def takes_screenshot; end1211 def takes_screenshot=(value); end1212 def takes_screenshot?; end1213 def to_json(*arg0); end1214 def version; end1215 def version=(value); end1216end1217module Selenium::WebDriver::Remote::OSS1218end1219class Selenium::WebDriver::Remote::OSS::Bridge < Selenium::WebDriver::Remote::Bridge1220 def accept_alert; end1221 def action; end1222 def active_element; end1223 def add_cookie(cookie); end1224 def alert=(keys); end1225 def alert_text; end1226 def assert_javascript_enabled; end1227 def authentication(credentials); end1228 def available_log_types; end1229 def clear_element(element); end1230 def clear_local_storage; end1231 def clear_session_storage; end1232 def click; end1233 def click_element(element); end1234 def close; end1235 def commands(command); end1236 def context_click; end1237 def cookies; end1238 def delete_all_cookies; end1239 def delete_cookie(name); end1240 def dialect; end1241 def dismiss_alert; end1242 def double_click; end1243 def drag_element(element, right_by, down_by); end1244 def element_attribute(element, name); end1245 def element_displayed?(element); end1246 def element_enabled?(element); end1247 def element_location(element); end1248 def element_location_once_scrolled_into_view(element); end1249 def element_property(element, name); end1250 def element_rect(element); end1251 def element_selected?(element); end1252 def element_size(element); end1253 def element_tag_name(element); end1254 def element_text(element); end1255 def element_value(element); end1256 def element_value_of_css_property(element, prop); end1257 def execute(*args); end1258 def execute_async_script(script, *args); end1259 def execute_script(script, *args); end1260 def find_element_by(how, what, parent = nil); end1261 def find_elements_by(how, what, parent = nil); end1262 def get(url); end1263 def go_back; end1264 def go_forward; end1265 def implicit_wait_timeout=(milliseconds); end1266 def initialize(capabilities, session_id, **opts); end1267 def keyboard; end1268 def local_storage_item(key, value = nil); end1269 def local_storage_keys; end1270 def local_storage_size; end1271 def location; end1272 def log(type); end1273 def manage; end1274 def maximize_window(handle = nil); end1275 def mouse; end1276 def mouse_down; end1277 def mouse_move_to(element, x = nil, y = nil); end1278 def mouse_up; end1279 def network_connection; end1280 def network_connection=(type); end1281 def page_source; end1282 def quit; end1283 def refresh; end1284 def remove_local_storage_item(key); end1285 def remove_session_storage_item(key); end1286 def reposition_window(x, y, handle = nil); end1287 def resize_window(width, height, handle = nil); end1288 def screen_orientation; end1289 def screen_orientation=(orientation); end1290 def screenshot; end1291 def script_timeout=(milliseconds); end1292 def send_keys_to_active_element(key); end1293 def send_keys_to_element(element, keys); end1294 def session_capabilities; end1295 def session_storage_item(key, value = nil); end1296 def session_storage_keys; end1297 def session_storage_size; end1298 def set_location(lat, lon, alt); end1299 def status; end1300 def submit_element(element); end1301 def switch_to_active_element; end1302 def switch_to_default_content; end1303 def switch_to_frame(id); end1304 def switch_to_parent_frame; end1305 def switch_to_window(name); end1306 def timeout(type, milliseconds); end1307 def title; end1308 def touch_double_tap(element); end1309 def touch_down(x, y); end1310 def touch_element_flick(element, right_by, down_by, speed); end1311 def touch_flick(xspeed, yspeed); end1312 def touch_long_press(element); end1313 def touch_move(x, y); end1314 def touch_scroll(element, x, y); end1315 def touch_single_tap(element); end1316 def touch_up(x, y); end1317 def upload(local_file); end1318 def url; end1319 def window_handle; end1320 def window_handles; end1321 def window_position(handle = nil); end1322 def window_size(handle = nil); end1323end1324module Selenium::WebDriver::Remote::W3C1325end1326class Selenium::WebDriver::Remote::W3C::Bridge < Selenium::WebDriver::Remote::Bridge1327 def accept_alert; end1328 def action(async = nil); end1329 def actions(async = nil); end1330 def active_element; end1331 def add_cookie(cookie); end1332 def alert=(keys); end1333 def alert_text; end1334 def clear_element(element); end1335 def clear_local_storage; end1336 def clear_session_storage; end1337 def click_element(element); end1338 def close; end1339 def commands(command); end1340 def convert_locators(how, what); end1341 def cookie(name); end1342 def cookies; end1343 def delete_all_cookies; end1344 def delete_cookie(name); end1345 def dialect; end1346 def dismiss_alert; end1347 def drag_element(element, right_by, down_by); end1348 def element_attribute(element, name); end1349 def element_displayed?(element); end1350 def element_enabled?(element); end1351 def element_location(element); end1352 def element_location_once_scrolled_into_view(element); end1353 def element_property(element, name); end1354 def element_rect(element); end1355 def element_selected?(element); end1356 def element_size(element); end1357 def element_tag_name(element); end1358 def element_text(element); end1359 def element_value(element); end1360 def element_value_of_css_property(element, prop); end1361 def escape_css(string); end1362 def execute(*arg0); end1363 def execute_async_script(script, *args); end1364 def execute_script(script, *args); end...

Full Screen

Full Screen

browser.rb

Source:browser.rb Github

copy

Full Screen

...42 @disable_cookies = original_disable_cookies43 end44 end45 def self.close_proxy46 if ExecutionEnvironment.proxy_enabled? and @proxy_started47 ::CoreMetricsManager.instance.update_har_entries if ExecutionEnvironment.proxy_enabled?('CoreMetrics')48 @proxy_started = nil49 Proxy.close_proxy50 end51 end52 def self.start_proxy53 if ExecutionEnvironment.proxy_enabled? and !@proxy_started54 @proxy_started = Proxy::start_proxy.selenium_proxy(:http, :ssl)55 end56 @proxy_started57 end58 def self.proxy59 ExecutionEnvironment.proxy_enabled? ? start_proxy : false60 end61 #62 # Sets up a browser instance, enabling any necessary browser capabilities.63 # @param [Symbol] browser One of: :firefox, :chrome, :ie64 #65 def self.setup(browser = ExecutionEnvironment.browser_name, clear_cookies = true)66 p ExecutionEnvironment.browser_name67 @is_first_visit_to_site = true68 if ENV['MOBILE_WEB']69 @browser = setup_mobile70 @browser71 elsif browser == :none72 nil73 else74 if ExecutionEnvironment.digital_analytics_enabled?('plugin')75 if ExecutionEnvironment.host_os != :windows || ExecutionEnvironment.browser_name != :firefox76 raise("ERROR - ENV: Digital Analytics runs only on Windows and Firefox")77 end78 end79 begin80 if ExecutionEnvironment.reuse_browser?81 @browser_count ||= 082 # reuse the browser from the second one. The first one will be close shortly and never used83 if @browser_count < 284 @browser = self.send "setup_#{browser.to_s}"85 maximize_browser_window86 @browser_count += 187 end88 else89 @browser = self.send "setup_#{browser.to_s}"90 maximize_browser_window91 end92 @browser.manage.delete_all_cookies if clear_cookies unless ExecutionEnvironment.browser_name == :safari || :ie93 @browser94 rescue Timeout::Error95 raise $!, "Unable to acquire a(n) '#{browser.to_s}' browser session from the hub." if ExecutionEnvironment.selenium_grid_hub96 raise97 end98 end99 end100 class << self101 private102 def common_capabilities103 caps = {}104 caps[:platform] = ExecutionEnvironment.browser_os if ExecutionEnvironment.browser_os105 caps[:version] = ExecutionEnvironment.browser_version if ExecutionEnvironment.browser_version106 caps107 end108 def setup_firefox109 if ExecutionEnvironment.selenium_grid_hub.nil?110 profile = Selenium::WebDriver::Firefox::Profile.new111 profile.log_file = browser_log_file_path("firefox")112 profile['network.cookie.cookieBehavior'] = 2 if @disable_cookies113 if ExecutionEnvironment::Features.noscript?114 untrusted = %w(bazaarvoice.com)115 profile.add_extension("vendor/firefox_extensions/noscript.xpi")116 profile["noscript.ABE.migration"] = 1117 profile["noscript.global"] = true118 profile["noscript.gtemp"] = ""119 profile["noscript.temp"] = ""120 profile["noscript.untrusted"] = untrusted.map { |domain| [domain, "http://#{domain}", "https://#{domain}"] }.flatten.join(' ')121 profile["noscript.version"] = "2.6.8.19"122 profile["noscript.visibleUIChecked"] = true123 Log.instance.debug "Running with 'noscript' plugin. Untrusted domains: #{untrusted}"124 end125 if ExecutionEnvironment::Features.akamai?126 profile.add_extension('vendor/firefox_extensions/modify_headers-0.7.1.1-fx.xpi', 'modifyheaders')127 profile.add_extension('vendor/firefox_extensions/firebug-2.0.4-fx.xpi', 'firebug')128 profile.add_extension('vendor/firefox_extensions/netExport-0.9b6.xpi', 'netexport')129 profile['modifyheaders.config.active'] = true130 profile['modifyheaders.config.alwaysOn'] = true131 profile['modifyheaders.config.openNewTab'] = true132 profile['modifyheaders.start'] = true133 headers = 'akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-cache-remote-on'134 profile['modifyheaders.headers.count'] = 1135 profile['modifyheaders.headers.action0'] = 'Add'136 profile['modifyheaders.headers.name0'] = 'Pragma'137 profile['modifyheaders.headers.value0'] = headers138 profile['modifyheaders.headers.enabled0'] = true139 profile['extensions.firebug.currentVersion'] = '2.0.4'140 profile['extensions.firebug.addonBarOpened'] = true141 profile['extensions.firebug.console.enableSites'] = true142 profile['extensions.firebug.script.enableSites'] = true143 profile['extensions.firebug.net.enableSites'] = true144 profile['extensions.firebug.previousPlacement'] = 1145 profile['extensions.firebug.allPagesActivation'] = 'on'146 profile['extensions.firebug.onByDefault'] = true147 profile['extensions.firebug.defaultPanelName'] = 'net'148 profile['extensions.firebug.netexport.alwaysEnableAutoExport'] = true149 profile['extensions.firebug.netexport.autoExportToFile'] = true150 profile['extensions.firebug.netexport.Automation'] = true151 profile['extensions.firebug.netexport.showPreview'] = false152 profile['extensions.firebug.netexport.includeResponseBodies'] = false153 profile['extensions.firebug.netexport.secretToken'] = 'macys'154 if ExecutionEnvironment.host_os == :windows155 profile['extensions.firebug.netexport.defaultLogDir'] = ExecutionEnvironment.log_directory.gsub('/','\\')156 else157 profile['extensions.firebug.netexport.defaultLogDir'] = ExecutionEnvironment.log_directory158 end159 end160 profile.proxy = start_proxy if ExecutionEnvironment.proxy_enabled?161 profile.add_extension('vendor/firefox_extensions/JSErrorCollector.xpi')162 if ExecutionEnvironment.digital_analytics_enabled?('plugin')163 profile.add_extension("vendor/firefox_extensions/coremetricstools@coremetrics.xpi")164 end165 Selenium::WebDriver.for :firefox, :profile => profile166 else167 caps = Selenium::WebDriver::Remote::Capabilities.firefox(common_capabilities)168 Selenium::WebDriver.for(:remote, :url => ExecutionEnvironment.selenium_grid_hub, :desired_capabilities => caps)169 end170 end171 def setup_chrome172 unless ExecutionEnvironment.selenium_grid_hub.nil?173 caps = Selenium::WebDriver::Remote::Capabilities.chrome(common_capabilities)174 return Selenium::WebDriver.for :remote, :url => ExecutionEnvironment.selenium_grid_hub, :desired_capabilities => caps175 end176 if ExecutionEnvironment::Features.akamai?177 extensions = "--load-extension=#{Dir.getwd}/vendor/chrome_extensions/HTTP_Spy/,#{Dir.getwd}/vendor/chrome_extensions/Modify_Headers/"178 return Selenium::WebDriver.for :chrome, :switches => [extensions], :proxy => proxy179 end180 caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["test-type", "--disable-extensions", "--kiosk-printing"]})181 Selenium::WebDriver.for :chrome, desired_capabilities: caps, proxy: proxy182 end183 def setup_ie184 opts = { :'ie.ensureCleanSession' => true, :enablePersistentHover => false, :nativeEvents => false }185 if ExecutionEnvironment.selenium_grid_hub.nil?186 caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(opts)187 Selenium::WebDriver.for :ie, :desired_capabilities => caps, :native_events => false188 else189 caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(opts.merge(common_capabilities))190 Selenium::WebDriver.for(:remote, :url => ExecutionEnvironment.selenium_grid_hub, :desired_capabilities => caps)191 end192 # This is breaking IE execution because the Selenium browser instance isn't returned.193 # In addition, the profile variable doesn't exist.194 #195 # if ExecutionEnvironment.proxy_enabled?196 # profile.proxy = Proxy::start_proxy.selenium_proxy(:http, :ssl) #proxy.selenium_proxy197 # end198 end199 def setup_phantomjs200 PhantomJS.instance.start_js_server201 Selenium::WebDriver.for(:phantomjs, url: 'http://localhost:' + ENV["PHANTOMJS_PORT"])202 end203 def setup_safari204 safari_user=File.expand_path('~')205 safari_path="#{safari_user}/Library/Safari"206 #FileUtils.rm_rf Dir.glob("#{safari_path}/*")207 dirs = Dir.entries("#{safari_path}").reject { |f| f =~ /Extensions|.DS_Store/ }208 dirs.each do |dir|209 unless dir.to_s == "." || dir.to_s == ".."...

Full Screen

Full Screen

common_helper.rb

Source:common_helper.rb Github

copy

Full Screen

...84 puts "Got StaleElementReferenceError error in '#{self.class.name}.#{__method__}', try again..."85 is_element_displayed?(hash_element)86 end87 end88 def is_element_enabled?(hash_element)89 begin90 el = find_element(hash_element)91 el.enabled?92 rescue Selenium::WebDriver::Error::StaleElementReferenceError93 puts "Got StaleElementReferenceError error in '#{self.class.name}.#{__method__}', try again..."94 is_element_enabled?(hash_element)95 end96 end97 def wait_for_element_exists(hash_element)98 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds99 wait.until { element_exist?(hash_element) }100 end101 def wait_for_element_does_not_exist(hash_element)102 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds103 wait.until { !element_exist?(hash_element) }104 end105 def wait_for_element_is_not_visible(hash_element)106 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds107 wait.until { !is_element_displayed?(hash_element) }108 end109 def wait_for_element_displayed(hash_element)110 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds111 wait.until { is_element_displayed?(hash_element) }112 end113 def wait_for_element_enabled(hash_element)114 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds115 wait.until { is_element_enabled?(hash_element) }116 end117 def wait_for_element_not_exist(element)118 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds119 wait.until { !element.nil? }120 end121 def wait_for_title(title)122 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds123 wait.until { get_title == title }124 end125 def wait_for_title_exist126 wait = Selenium::WebDriver::Wait.new(:timeout => $implicit_wait_time) # seconds127 wait.until { get_title != ''}128 end129 def get_title130 @driver.title131 end132 def close_browser133 @driver.close134 end135 def fill_field(hash_element, value)136 if hash_element.class == Selenium::WebDriver::Element137 element = hash_element138 else139 element = find_element(hash_element)140 end141 if element.enabled?142 if element.tag_name == 'select'143 wait_drop_down(element)144 options = element.find_elements(tag_name: 'option')145 options.each do |option|146 if option.text == value147 option.click unless option.attribute('selected')148 break149 end150 end151 elsif element.attribute('role') == 'listbox'152 result = false153 wait_listbox(element)154 list = element.find_elements(tag_name: 'li')155 list.each_with_index do |li, index|...

Full Screen

Full Screen

test_environment.rb

Source:test_environment.rb Github

copy

Full Screen

...106 raise ex107 end108 def remote_capabilities109 caps = WebDriver::Remote::Capabilities.send(ENV['WD_REMOTE_BROWSER'] || 'firefox')110 caps.javascript_enabled = true111 caps.css_selectors_enabled = true112 caps113 end114 MAX_ERRORS = 4115 class DriverInstantiationError < StandardError116 end117 def check_for_previous_error118 return unless @create_driver_error && @create_driver_error_count >= MAX_ERRORS119 msg = "previous #{@create_driver_error_count} instantiations of driver #{driver.inspect} failed, not trying again"120 msg << " (#{@create_driver_error.message})"121 raise DriverInstantiationError, msg, @create_driver_error.backtrace122 end123 def create_remote_driver124 WebDriver::Driver.for(:remote,125 :desired_capabilities => remote_capabilities,...

Full Screen

Full Screen

20111207165052_add_webdriver_user_functions.rb

Source:20111207165052_add_webdriver_user_functions.rb Github

copy

Full Screen

...8 :user_id => @user.id,9 :name => "webdriver_init",10 :description => "Función para comenzar utilizar el nodo de WD",11 :cant_args => 1,12 :source_code => "def new_object.webdriver_init(iii);#------------------------------------------------------------------------------------------------------\n#Librerias\n#------------------------------------------------------------------------------------------------------\nrequire \"rubygems\"\nrequire \"selenium/client\"\nrequire \"selenium-webdriver\"\n\n#brows=brows.downcase\n\n#urlhub = \"http://10.4.255.99:5555/wd/hub\"\n\n case platform\n when \"Firefox3.6 on Windows\"\n brows = \"firefox\"\n vrsn = \"3.6\"\n when \"IE7 on Windows\"\n brows = \"iexplore\"\n vrsn = \"7\"\n when \"IE8 on Windows\"\n brows = \"iexplore\"\n vrsn = \"8\"\n when \"Chrome on Windows\"\n brows = \"googlechrome\"\n vrsn = \"\"\n end\n\n\n#------------------------------------------------------------------------------------------------------\n#Creacion de Capabilities\n#------------------------------------------------------------------------------------------------------\n\n\tif brows.match(/ie/) or brows.match(/explorer/) or brows.match(/iexplore/) or brows.match(\"internet explorer\")\n caps = Selenium::WebDriver::Remote::Capabilities.ie(:javascript_enabled => true)\n\telsif brows.match(/chrome/) or brows.match(\"googlechrome\")\n caps = Selenium::WebDriver::Remote::Capabilities.chrome(:javascript_enabled => true)\n\telsif brows.match(/firefox/)\n\tcaps = Selenium::WebDriver::Remote::Capabilities.firefox(:javascript_enabled => true)\n\telsif brows.match(/htmlunit/)\n\tcaps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => true)\n\tend\n\n\nif (remote_control_addr == HUB_IP )\n#------------------------------------------------------------------------------------------------------\n#Ejecución automática\n#------------------------------------------------------------------------------------------------------\n\turlhub = \"http://10.4.255.99:5555/wd/hub\"\nelse\n#------------------------------------------------------------------------------------------------------\n#Ejecución Cacique en mi PC\n#------------------------------------------------------------------------------------------------------\n\turlhub = \"http://\#{remote_control_addr}:\#{remote_control_port}/wd/hub\"\nend\n\n\n@webdriver = Selenium::WebDriver.for :remote,:url => urlhub , :desired_capabilities => caps\n@webdriver.navigate.to url\n \n \n@driver = @webdriver\n \n end;",13 :example => "webdriver_init(\"http://www.mercadolibre.com\", \"IE9 on Windows\")",14 :hide=> true, 15 :visibility=> true,16 :native_params=> true)17 raise "Error: No es posible crear la función webdriver_init\n" + @user_function.errors.full_messages.join("\n") if !@user_function.save18 end19 def self.down20 end21end

Full Screen

Full Screen

constants.rb

Source:constants.rb Github

copy

Full Screen

1module Ptera2 FIREFOX_HEADLESS = proc { |app|3 profile = Selenium::WebDriver::Firefox::Profile.new4 profile['devtools.jsonview.enabled'] = false5 options = Selenium::WebDriver::Firefox::Options.new(profile: profile)6 options.headless!7 # profile["general.useragent.override"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15"8 Capybara::Selenium::Driver.new(app, options: options)9 }10 FIREFOX_NORMAL = proc { |app|11 profile = Selenium::WebDriver::Firefox::Profile.new12 profile['devtools.jsonview.enabled'] = false13 options = Selenium::WebDriver::Firefox::Options.new(profile: profile)14 # options.headless!15 # profile["general.useragent.override"] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15"16 Capybara::Selenium::Driver.new(app, options: options)17 }18 FIREFOX_WITH_PROXY = proc { |proxy_host|19 proc { |app|20 profile = Selenium::WebDriver::Firefox::Profile.new21 profile['devtools.jsonview.enabled'] = false22 profile.proxy = Selenium::WebDriver::Proxy.new(http: proxy_host, ssl: proxy_host)23 options = Selenium::WebDriver::Firefox::Options.new(profile: profile)24 Capybara::Selenium::Driver.new(app, options: options)25 }26 }27 FIREFOX_WITH_DOWNLOAD = proc { |download_dir|28 proc { |app|29 profile = Selenium::WebDriver::Firefox::Profile.new30 profile['devtools.jsonview.enabled'] = false31 FileUtils.mkdir_p(download_dir)32 profile['browser.download.dir'] = download_dir.to_s33 profile['browser.download.folderList'] = 234 profile['browser.helperApps.alwaysAsk.force'] = false35 profile['browser.download.manager.showWhenStarting'] = false36 profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv"37 options = Selenium::WebDriver::Firefox::Options.new(profile: profile)38 # options.headless!39 Capybara::Selenium::Driver.new(app, options: options)40 }41 }42 FIREFOX_WITH_DOWNLOAD_HEADLESS = proc { |download_dir|43 proc { |app|44 profile = Selenium::WebDriver::Firefox::Profile.new45 profile['devtools.jsonview.enabled'] = false46 FileUtils.mkdir_p(download_dir)47 profile['browser.download.dir'] = download_dir.to_s48 profile['browser.download.folderList'] = 249 profile['browser.helperApps.alwaysAsk.force'] = false50 profile['browser.download.manager.showWhenStarting'] = false51 profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv"52 options = Selenium::WebDriver::Firefox::Options.new(profile: profile)53 options.headless!54 Capybara::Selenium::Driver.new(app, options: options)55 }56 }57end...

Full Screen

Full Screen

env.rb

Source:env.rb Github

copy

Full Screen

...26puts "Browser : #{browser}"27Capybara.register_driver :firefox do |app|28 profile = Selenium::WebDriver::Firefox::Profile.new29 options = Selenium::WebDriver::Firefox::Options.new30 options.add_preference 'dom.webdriver.enabled', false31 options.add_preference 'dom.webnotifications.enabled', false32 options.add_preference 'dom.push.enabled', false33 options.profile = profile34 client = Selenium::WebDriver::Remote::Http::Default.new35 client.open_timeout = wait_time36 client.read_timeout = wait_time37 Capybara::Selenium::Driver.new(38 app,39 browser: :firefox,40 options: options,41 http_client: client42 )43end44Capybara.register_driver :chrome do |app|45 options = Selenium::WebDriver::Chrome::Options.new46 options.add_argument('--no-sandbox')...

Full Screen

Full Screen

waiting_helpers.rb

Source:waiting_helpers.rb Github

copy

Full Screen

1# Waiting methods helpers2module WaitingHelpers3 def self.wait_for_element_be_enabled(element, timeout = 15)4 wait = Selenium::WebDriver::Wait.new timeout: timeout5 begin6 wait.until { find_element(element).enabled? }7 rescue StandardError8 p "[warn] timed out waiting #{element} be enabled."9 end10 end11 def self.wait_for_element_be_displayed(element, timeout = 15)12 wait = Selenium::WebDriver::Wait.new timeout: timeout13 begin14 wait.until { find_element(element).displayed? }15 rescue StandardError16 p "[warn] timed out waiting #{element} be displayed."17 end18 end19 def self.wait_for_element_not_be_displayed(element, timeout = 15)20 wait = Selenium::WebDriver::Wait.new timeout: timeout21 begin22 wait.until { find_element(element).displayed?.eql? false }23 rescue Selenium::WebDriver::Error::NoSuchElementError, Selenium::WebDriver::Error::StaleElementReferenceError,24 StandardError25 false26 end27 end28 def self.wait_for_text_be_displayed(element, text, index = 0, timeout = 15)29 wait = Selenium::WebDriver::Wait.new timeout: timeout30 begin31 wait.until { find_elements(element)[index].text.eql? text }32 rescue Selenium::WebDriver::Error::StaleElementReferenceError33 false34 end35 end36 def self.element_displayed?(element)37 find_element(element).displayed?38 rescue Selenium::WebDriver::Error::NoSuchElementError, Selenium::WebDriver::Error::StaleElementReferenceError39 false40 end41 def self.element_enabled?(element)42 find_element(element).enabled?43 rescue Selenium::WebDriver::Error::NoSuchElementError, Selenium::WebDriver::Error::StaleElementReferenceError44 false45 end46end...

Full Screen

Full Screen

enabled

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, "q").send_keys "Selenium WebDriver"2driver.find_element(:name, "btnG").click3browser.text_field(:name, "q").set "Selenium WebDriver"4browser.button(:name, "btnG").click

Full Screen

Full Screen

enabled

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, 'q').send_keys 'Selenium WebDriver'2driver.find_element(:name, 'btnG').click3driver.find_element(:name, 'q').send_keys 'Selenium WebDriver'4driver.find_element(:name, 'btnG').click5I have tried to run the above two code files (1.rb and 2.rb) in the following ways:

Full Screen

Full Screen

enabled

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2wait.until { driver.title.downcase.start_with? "cheese!" }3element = driver.find_element(:name, 'q')4wait.until { driver.title.downcase.start_with? "cheese!" }5element = driver.find_element(:name, 'q')

Full Screen

Full Screen

enabled

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, 'q').send_keys 'Selenium WebDriver'2driver.find_element(:name, 'btnG').click3driver.find_element(:name, 'q').send_keys 'Selenium WebDriver'4driver.find_element(:name, 'btnG').click5I have tried to run the above two code files (1.rb and 2.rb) in the following ways:

Full Screen

Full Screen

enabled

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2wait.until { driver.title.downcase.start_with? "cheese!" }3element = driver.find_element(:name, 'q')4wait.until { driver.title.downcase.start_with? "cheese!" }5element = driver.find_element(:name, 'q')

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful