Пример #1
0
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
Пример #2
0
 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}))
Пример #3
0
 def test_supported(self):
     for path, cssified in SUPPORTED:
         self.assertEqual(cssify.cssify(path), cssified)
Пример #4
0
 def test_supported(self):
     for path, cssified in SUPPORTED:
         self.assertEqual(cssify.cssify(path), cssified)
Пример #5
0
#from selenium import selenium
from cssify import cssify
print cssify('//a[@id="bleh"]')
print cssify ('//input[@value="era"]')
Пример #6
0
async def selecione(page, xpath, opcao):
    await page.waitForXPath(xpath)
    await page.type(cssify(xpath), opcao)
    await wait_page(page)
Пример #7
0
async def digite(page, xpath, texto):
    await page.type(cssify(xpath), texto)
Пример #8
0
async def clique(page, xpath):
    await page.waitForXPath(xpath)
    await page.click(cssify(xpath))
    await wait_page(page)
Пример #9
0
                      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.
Пример #10
0
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
Пример #11
0
async def selecione(pagina, xpath, opcao):
    await pagina.waitForXPath(xpath)
    await pagina.type(cssify(xpath), opcao)
    await espere_pagina(pagina)
Пример #12
0
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)