How to use read_id_from_manifest_json method of Selenium.WebDriver.Firefox Package

Best Selenium code snippet using Selenium.WebDriver.Firefox.read_id_from_manifest_json


Source:extension.rb Github


Full Screen

...48 Zipper.unzip(@path)49 end50 end51 def read_id(directory)52 read_id_from_install_rdf(directory) || read_id_from_manifest_json(directory)53 end54 def read_id_from_install_rdf(directory)55 rdf_path = File.join(directory, 'install.rdf')56 return unless File.exist?(rdf_path)57 doc = namespace = doc.root.namespaces.key(NAMESPACE)59 if namespace60 id_node = REXML::XPath.first(doc, "//#{namespace}:id")61 return id_node.text if id_node62 attr_node = REXML::XPath.first(doc, "//@#{namespace}:id")63 return attr_node.value if attr_node64 end65 raise Error::WebDriverError, "cannot locate extension id in #{rdf_path}"66 end67 def read_id_from_manifest_json(directory)68 manifest_path = File.join(directory, 'manifest.json')69 return unless File.exist?(manifest_path)70 manifest = JSON.parse( applications_gecko_id(manifest) || name_and_version(manifest)72 end73 def applications_gecko_id(manifest)74 manifest.dig('applications', 'gecko', 'id')&.strip75 end76 def name_and_version(manifest)77 [manifest['name'].delete(' '), manifest['version']].join('@')78 end79 end # Extension80 end # Firefox81 end # WebDriver...

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:


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

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?