def xpath_to_css(xpath, quote): """Convert an xpath expression to a css expression Attempts xpath to css conversion, if fails, returns the xpath Args: xpath: xpath string quote: single or double-quote ' or " Returns: xpath converted to css, or xpath if conversion fails """ try: css = cssify.cssify(xpath) verbose("'{0}' converted to '{1}".format(xpath, css)) css = css.replace(quote, "\\{0}".format(quote)) # escape quote global replace_count replace_count += 1 return "css={0}".format(css) except cssify.XpathException: verbose("Unable to convert xpath '{0}' to css expression".format(xpath)) global xpath_skip_count xpath_skip_count += 1 return xpath
def post(self): xpath = self.request.get('xpath') if xpath: self.response.headers['Content-Type'] = 'application/json' try: css = cssify(xpath) except XpathException, e: self.response.out.write(json.dumps({'status': 'fail', 'response': str(e)})) else: self.response.out.write(json.dumps({'status': 'pass', 'response': css}))
def test_supported(self): for path, cssified in SUPPORTED: self.assertEqual(cssify.cssify(path), cssified)
#from selenium import selenium from cssify import cssify print cssify('//a[@id="bleh"]') print cssify ('//input[@value="era"]')
async def selecione(page, xpath, opcao): await page.waitForXPath(xpath) await page.type(cssify(xpath), opcao) await wait_page(page)
async def digite(page, xpath, texto): await page.type(cssify(xpath), texto)
async def clique(page, xpath): await page.waitForXPath(xpath) await page.click(cssify(xpath)) await wait_page(page)
action="store_true", dest="verbose", default=False, help="print status messages to stdout") (options, args) = parser.parse_args() if options.verbose: def log(msg): print "> %s" % msg else: def log(msg): pass if len(args) != 1: parser.error("incorrect number of arguments") try: print cssify(args[0]) except XpathException, e: print e sys.exit(1) else: def log(msg): pass ########NEW FILE######## __FILENAME__ = main #!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.
from import_module_ex import add123 from import_module_ex import module_test from cssify import cssify from upper_case import upper_case_convert #print add123() a1 = module_test('frock','car' ,'hi') data = a1.age_verify(15) print upper_case_convert(data) print cssify('//input[@value="python"]') #C:\Users\Ramya\QAdata_as_of_Feb172011\python_problems\imp_modules
async def selecione(pagina, xpath, opcao): await pagina.waitForXPath(xpath) await pagina.type(cssify(xpath), opcao) await espere_pagina(pagina)
async def digite(pagina, xpath, texto): await pagina.querySelectorEval(cssify(xpath), 'el => el.value = ""') await pagina.click(cssify(xpath)) time.sleep(1) await pagina.type(cssify(xpath), texto)