Question: How do I scroll through a modal window that is created using Bootstrap's modal class? Generally we use the JavascriptExecutor and use the window.scroll/scrollBy method. But when I tried the same when a modal is popped up with long content, the scroll is happening in the actual webpage which is not focused. How do I scroll through content in a modal popup that has long content? 

Example - Modal popup here: <https://v4-alpha.getbootstrap.com/components/modal/#scrolling-long-content>

Answer: 
This script captures the `-i` command, while still allowing `unittest.main` to do its own commandline parsing:

```
import unittest

class Testclass(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        print "Hello Class"

    def test_addnum(self):
        print "Execute the test case"
        #parser = parse_args(['-i'])
        print 'simple_value     =', args.inputfile

import argparse
def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', help='input file', dest='inputfile')
    ns, args = parser.parse_known_args(namespace=unittest)
    #args = parser.parse_args()
    return ns, sys.argv[:1] + args

if __name__ == '__main__':
    import sys
    args, argv = parse_args()   # run this first
    print(args, argv)
    sys.argv[:] = argv       # create cleans argv for main()
    unittest.main()

```

produces:

```
1113:~/mypy$ python stack44236745.py -i testname -v
(<module 'unittest' from '/usr/lib/python2.7/unittest/__init__.pyc'>, ['stack44236745.py', '-v'])
Hello Class
test_addnum (__main__.Testclass) ... Execute the test case
simple_value     = testname
ok

----------------------------------------------------------------------
Ran 1 test in 0.000s
OK

```

It looks rather kludgy, but does seem to work.

The idea is to run your own parser first, capturing the `-i` input, and putting the rest back into `sys.argv`. Your definition of `parse_args` suggests that you are already trying to do that.
Thanks hpaulj, your solution really helped me and I found one more solution for this problem. Hope it helps someone else facing the same issue.

```
import unittest
import argparse
import sys

class Testclass(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        print "Hello Class"

    def test_addnum(self):
        print "Execute the test case"
        #parser = parse_args(['-i'])
        print 'simple_value     =', args.inputfile

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('-i', help='input file', dest='inputfile')
    parser.add_argument('unittest_args', nargs='*')
    args = parser.parse_args()
    sys.argv[1:] = args.unittest_args
    unittest.main()

```

Now executing the script with option `-i` as `python testing.py -i somefile.txt` gives result as 

```
Hello Class
Execute the test case
simple_value     = somefile.txt
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

```