sw/qa/python/check_indexed_property_values.py                   |    1 
 sw/qa/python/check_named_property_values.py                     |    1 
 sw/qa/python/text_portion_enumeration_test.py                   |    6 --
 sw/qa/uitest/chapterNumbering/tdf123547.py                      |    1 
 sw/qa/uitest/chapterNumbering/tdf145215.py                      |    1 
 sw/qa/uitest/chart/tdf138556.py                                 |    2 
 sw/qa/uitest/classification/classification.py                   |   17 -------
 sw/qa/uitest/fieldDialog/tdf135377.py                           |    2 
 sw/qa/uitest/fieldDialog/tdf143483.py                           |    1 
 sw/qa/uitest/fieldDialog/tdf146462.py                           |    3 -
 sw/qa/uitest/fieldDialog/tdf148551.py                           |    5 --
 sw/qa/uitest/findReplace/findReplace.py                         |    3 -
 sw/qa/uitest/findReplace/findSimilarity.py                      |    2 
 sw/qa/uitest/findReplace/tdf106099.py                           |    1 
 sw/qa/uitest/findReplace/tdf118208.py                           |    1 
 sw/qa/uitest/findReplace/tdf119462.py                           |    1 
 sw/qa/uitest/findReplace/tdf137737.py                           |    4 -
 sw/qa/uitest/navigator/tdf114724.py                             |    2 
 sw/qa/uitest/navigator/tdf134960.py                             |    4 -
 sw/qa/uitest/navigator/tdf140661.py                             |    2 
 sw/qa/uitest/navigator/tdf143569.py                             |    2 
 sw/qa/uitest/navigator/tdf144672.py                             |    2 
 sw/qa/uitest/options/tdf78133.py                                |    3 -
 sw/qa/uitest/sidebar/tdf99711.py                                |    2 
 sw/qa/uitest/styleInspector/styleInspector.py                   |    2 
 sw/qa/uitest/table/sheetToTable.py                              |   10 ----
 sw/qa/uitest/table/splitTable.py                                |    3 -
 sw/qa/uitest/table/tableProperties.py                           |    3 -
 sw/qa/uitest/table/tableToText.py                               |    1 
 sw/qa/uitest/table/tdf115572.py                                 |    2 
 sw/qa/uitest/table/tdf115573.py                                 |    4 -
 sw/qa/uitest/table/tdf116737.py                                 |    1 
 sw/qa/uitest/table/tdf134881_colProportionalAdjust.py           |    3 -
 sw/qa/uitest/table/tdf135693.py                                 |    2 
 sw/qa/uitest/table/tdf140506.py                                 |    4 -
 sw/qa/uitest/table/tdf146145.py                                 |    2 
 sw/qa/uitest/table/tdf81292.py                                  |    1 
 sw/qa/uitest/table/tdf99334.py                                  |    1 
 sw/qa/uitest/table/textToTable.py                               |    2 
 sw/qa/uitest/ui/fmtui/fmtui.py                                  |    1 
 sw/qa/uitest/uibase/shells/shells.py                            |    2 
 sw/qa/uitest/writer_tests/compareDocuments.py                   |    8 ---
 sw/qa/uitest/writer_tests/insertCaption.py                      |    2 
 sw/qa/uitest/writer_tests/tdf134734.py                          |    2 
 sw/qa/uitest/writer_tests/tdf81457.py                           |    2 
 sw/qa/uitest/writer_tests/trackedChanges.py                     |   13 -----
 sw/qa/uitest/writer_tests/versionDialog.py                      |    4 -
 sw/qa/uitest/writer_tests/watermark.py                          |    1 
 sw/qa/uitest/writer_tests/wordCount.py                          |   23 
+++-------
 sw/qa/uitest/writer_tests2/asianPhoneticGuide.py                |    1 
 sw/qa/uitest/writer_tests2/deleteAllComments.py                 |    3 -
 sw/qa/uitest/writer_tests2/fontworks.py                         |    2 
 sw/qa/uitest/writer_tests2/formatBulletsNumbering.py            |    5 --
 sw/qa/uitest/writer_tests2/formatCharacter.py                   |   16 ++----
 sw/qa/uitest/writer_tests2/formatParagraph.py                   |   12 -----
 sw/qa/uitest/writer_tests2/tdf116474.py                         |    2 
 sw/qa/uitest/writer_tests2/tdf146375.py                         |    2 
 sw/qa/uitest/writer_tests3/goToPage.py                          |    2 
 sw/qa/uitest/writer_tests3/hyperlinkdialog.py                   |    3 -
 sw/qa/uitest/writer_tests3/insertEnvelope.py                    |    1 
 sw/qa/uitest/writer_tests3/insertFootEndnote.py                 |    1 
 sw/qa/uitest/writer_tests3/insertPageFooter.py                  |    2 
 sw/qa/uitest/writer_tests3/insertQrCodeGen.py                   |    1 
 sw/qa/uitest/writer_tests3/insertSignatureLine.py               |    1 
 sw/qa/uitest/writer_tests3/pageDialog.py                        |    2 
 sw/qa/uitest/writer_tests3/sort.py                              |    1 
 sw/qa/uitest/writer_tests3/specialCharacter.py                  |    7 ---
 sw/qa/uitest/writer_tests4/exportToPDF.py                       |    2 
 sw/qa/uitest/writer_tests4/insertBreakDialog.py                 |    1 
 sw/qa/uitest/writer_tests4/insertPageHeader.py                  |    2 
 sw/qa/uitest/writer_tests4/tdf122449.py                         |    2 
 sw/qa/uitest/writer_tests4/tdf134439.py                         |    1 
 sw/qa/uitest/writer_tests4/tdf138546.py                         |    1 
 sw/qa/uitest/writer_tests4/tdf148395.py                         |    1 
 sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py     |    9 ---
 sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py |   12 +----
 sw/qa/uitest/writer_tests5/autocorrectOptions.py                |    2 
 sw/qa/uitest/writer_tests5/columns.py                           |    1 
 sw/qa/uitest/writer_tests5/tdf106899.py                         |    1 
 sw/qa/uitest/writer_tests5/tdf122045.py                         |    1 
 sw/qa/uitest/writer_tests5/tdf122722.py                         |   14 ------
 sw/qa/uitest/writer_tests5/tdf123378.py                         |    1 
 sw/qa/uitest/writer_tests5/tdf138531.py                         |    2 
 sw/qa/uitest/writer_tests5/tdf142847.py                         |    4 -
 sw/qa/uitest/writer_tests5/tdf147935.py                         |    3 -
 sw/qa/uitest/writer_tests5/tdf148920.py                         |    2 
 sw/qa/uitest/writer_tests5/titlePage.py                         |    1 
 sw/qa/uitest/writer_tests5/zoom.py                              |    1 
 sw/qa/uitest/writer_tests6/save_readonly_with_password.py       |    2 
 sw/qa/uitest/writer_tests6/tdf107847.py                         |    1 
 sw/qa/uitest/writer_tests6/tdf120731.py                         |    1 
 sw/qa/uitest/writer_tests6/tdf124586.py                         |    1 
 sw/qa/uitest/writer_tests6/tdf125104.py                         |    1 
 sw/qa/uitest/writer_tests6/tdf126017.py                         |    1 
 sw/qa/uitest/writer_tests6/tdf126168.py                         |    2 
 sw/qa/uitest/writer_tests6/tdf126226.py                         |    2 
 sw/qa/uitest/writer_tests6/tdf141957.py                         |    1 
 sw/qa/uitest/writer_tests7/tdf104795.py                         |    2 
 sw/qa/uitest/writer_tests7/tdf122780.py                         |    2 
 sw/qa/uitest/writer_tests7/tdf133348.py                         |    5 --
 sw/qa/uitest/writer_tests7/tdf134243.py                         |    2 
 sw/qa/uitest/writer_tests7/tdf140117.py                         |    1 
 sw/qa/uitest/writer_tests7/tdf141158.py                         |    2 
 sw/qa/uitest/writer_tests7/tdf141557.py                         |    3 -
 sw/qa/uitest/writer_tests7/tdf143574.py                         |    1 
 sw/qa/uitest/writer_tests7/tdf143785.py                         |    9 ---
 sw/qa/uitest/writer_tests7/tdf144578.py                         |    2 
 sw/qa/uitest/writer_tests7/tdf145093.py                         |    5 --
 sw/qa/uitest/writer_tests7/tdf145178.py                         |    1 
 sw/qa/uitest/writer_tests7/tdf146605.py                         |    1 
 sw/qa/uitest/writer_tests7/tdf90401.py                          |   10 ----
 111 files changed, 70 insertions(+), 284 deletions(-)

New commits:
commit 3258bfd178749fd3deb06d852389554c69299c1e
Author:     m.hashemian <mr.hashemian2...@gmail.com>
AuthorDate: Wed Jun 29 20:08:24 2022 +0430
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 30 09:57:38 2022 +0200

    tdf#132293 remove unused imports and unused variables in sw
    
    Change-Id: I00ae07a9d02e834de34f8dd7a7f53f0c68490832
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136627
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/python/check_indexed_property_values.py 
b/sw/qa/python/check_indexed_property_values.py
index 4179872cea4b..d6d314adc894 100644
--- a/sw/qa/python/check_indexed_property_values.py
+++ b/sw/qa/python/check_indexed_property_values.py
@@ -50,7 +50,6 @@ class CheckIndexedPropertyValues(unittest.TestCase):
         p3 = PropertyValue(Name="Peter", Value="FamilyGuy")
         prop3 = uno.Any("[]com.sun.star.beans.PropertyValue", (p3,))
 
-        t = xCont.getElementType()
         self.assertEqual(0, len(xCont), "Initial container is not empty")
         uno.invoke(xCont, "insertByIndex", (0, prop1))
 
diff --git a/sw/qa/python/check_named_property_values.py 
b/sw/qa/python/check_named_property_values.py
index d11ee2e46651..39d4b33cacc9 100644
--- a/sw/qa/python/check_named_property_values.py
+++ b/sw/qa/python/check_named_property_values.py
@@ -49,7 +49,6 @@ class CheckNamedPropertyValues(unittest.TestCase):
         p2 = PropertyValue(Name="Horst", Value="BadGuy")
         prop2 = uno.Any("[]com.sun.star.beans.PropertyValue", (p2,))
 
-        t = xCont.getElementType()
         self.assertFalse(xCont.hasElements(),  "Initial container is not 
empty")
 
         uno.invoke(xCont, "insertByName", ("prop1", prop1))
diff --git a/sw/qa/python/text_portion_enumeration_test.py 
b/sw/qa/python/text_portion_enumeration_test.py
index 47f7c21e5307..3de536dc7c8f 100644
--- a/sw/qa/python/text_portion_enumeration_test.py
+++ b/sw/qa/python/text_portion_enumeration_test.py
@@ -1514,7 +1514,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
         name2 = self.mkname("toxmark")
         name3 = self.mkname("bookmark")
         name4 = self.mkname("frame")
-        name5 = self.mkname("url")
+        # name5 = self.mkname("url")
         name6 = self.mkname("ruby")
         name7 = self.mkname("refmark")
         name8 = self.mkname("toxmark")
@@ -3295,7 +3295,6 @@ class TextPortionEnumerationTest(unittest.TestCase):
             self.close(xComp)
 
     def checkloadmeta(self, xTextDoc):
-        xText = xTextDoc.getText()
         print("Checking meta(-field)s in loaded test document...")
         root = TreeNode()
         root.appendchild(RubyNode("ruby1")
@@ -3365,7 +3364,6 @@ class TextPortionEnumerationTest(unittest.TestCase):
             self.close(xComp)
 
     def checkloadxmlid(self, xTextDoc):
-        xText = xTextDoc.getText()
         xRepo = xTextDoc.getRDFRepository()
 
         print("Checking bookmarks in loaded test document...")
@@ -3491,7 +3489,7 @@ class TextPortionEnumerationTest(unittest.TestCase):
         return "{}{}".format(prefix, self.__class__.count)
 
     def mkid(self, prefix):
-        id = self.mkname(prefix)
+        self.mkname(prefix)
         return StringPair("content.xml", self.mkname(prefix))
 
     def mkid_(self, id):
diff --git a/sw/qa/uitest/chapterNumbering/tdf123547.py 
b/sw/qa/uitest/chapterNumbering/tdf123547.py
index ae40e3128293..a8309acaf48e 100644
--- a/sw/qa/uitest/chapterNumbering/tdf123547.py
+++ b/sw/qa/uitest/chapterNumbering/tdf123547.py
@@ -16,7 +16,6 @@ from uitest.uihelper.common import select_pos
 class tdf123547(UITestCase):
    def test_tdf123547_numbering_dialog_crash(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/chapterNumbering/tdf145215.py 
b/sw/qa/uitest/chapterNumbering/tdf145215.py
index 29c119730a71..3cb234c8819a 100644
--- a/sw/qa/uitest/chapterNumbering/tdf145215.py
+++ b/sw/qa/uitest/chapterNumbering/tdf145215.py
@@ -15,7 +15,6 @@ class Tdf145215(UITestCase):
     def test_tdf145215(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf145215.docx")) 
as writer_doc:
             with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
-                xTab = xDialog.getChild("tabcontrol")
 
                 # Select level "4"
                 xLevel = xDialog.getChild("level")
diff --git a/sw/qa/uitest/chart/tdf138556.py b/sw/qa/uitest/chart/tdf138556.py
index b6e2c7d9ff17..3fc7bb19734d 100644
--- a/sw/qa/uitest/chart/tdf138556.py
+++ b/sw/qa/uitest/chart/tdf138556.py
@@ -10,14 +10,12 @@
 from libreoffice.uno.propertyvalue import mkPropertyValues
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict
 
 class tdf138556( UITestCase ):
 
     def test_stock_chart13_insert_series( self ):
         #Start LibreOffice Writer
         with self.ui_test.create_doc_in_start_center( "writer" ):
-            xMainTop = self.xUITest.getTopFocusWindow()
 
             #Insert Chart
             self.xUITest.executeCommand( ".uno:InsertObjectChart" )
diff --git a/sw/qa/uitest/classification/classification.py 
b/sw/qa/uitest/classification/classification.py
index c4b1f91029eb..454d9553a86b 100644
--- a/sw/qa/uitest/classification/classification.py
+++ b/sw/qa/uitest/classification/classification.py
@@ -41,14 +41,9 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 class classification(UITestCase):
     def test_document_classification_dialog(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             with 
self.ui_test.execute_dialog_through_command(".uno:ClassificationDialog") as 
xDialog:
-                classificationEditWindow = 
xDialog.getChild("classificationEditWindow")
-                recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
                 classificationCB = xDialog.getChild("classificationCB")
                 internationalClassificationCB = 
xDialog.getChild("internationalClassificationCB")
-                intellectualPropertyPartEntry = 
xDialog.getChild("intellectualPropertyPartEntry")
-                intellectualPropertyPartAddButton = 
xDialog.getChild("intellectualPropertyPartAddButton")
 
                 select_by_text(classificationCB, "Confidential")
                 #verify International is set too
@@ -79,12 +74,8 @@ class classification(UITestCase):
 
             #do the same for Paragraph classification
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
 as xDialog:
-                classificationEditWindow = 
xDialog.getChild("classificationEditWindow")
-                recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
                 classificationCB = xDialog.getChild("classificationCB")
                 internationalClassificationCB = 
xDialog.getChild("internationalClassificationCB")
-                intellectualPropertyPartEntry = 
xDialog.getChild("intellectualPropertyPartEntry")
-                intellectualPropertyPartAddButton = 
xDialog.getChild("intellectualPropertyPartAddButton")
 
                 select_by_text(classificationCB, "Confidential")
                 #verify International is set too
@@ -99,15 +90,10 @@ class classification(UITestCase):
 
     def test_paragraph_classification_dialog(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #+ new file and do it only for Paragraph classification (no 
watermark!)
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
 as xDialog:
-                classificationEditWindow = 
xDialog.getChild("classificationEditWindow")
-                recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
                 classificationCB = xDialog.getChild("classificationCB")
                 internationalClassificationCB = 
xDialog.getChild("internationalClassificationCB")
-                intellectualPropertyPartEntry = 
xDialog.getChild("intellectualPropertyPartEntry")
-                intellectualPropertyPartAddButton = 
xDialog.getChild("intellectualPropertyPartAddButton")
 
                 select_by_text(classificationCB, "Confidential")
                 #verify International is set too
@@ -123,11 +109,8 @@ class classification(UITestCase):
 
     def test_paragraph_classification_dialog_text(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #+ new file and do it only for Paragraph classification (no 
watermark!)
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphClassificationDialog")
 as xDialog:
-                classificationEditWindow = 
xDialog.getChild("classificationEditWindow")
-                recentlyUsedCB = xDialog.getChild("recentlyUsedCB")
                 classificationCB = xDialog.getChild("classificationCB")
                 internationalClassificationCB = 
xDialog.getChild("internationalClassificationCB")
                 intellectualPropertyPartEntry = 
xDialog.getChild("intellectualPropertyPartEntry")
diff --git a/sw/qa/uitest/fieldDialog/tdf135377.py 
b/sw/qa/uitest/fieldDialog/tdf135377.py
index b5751bedf8ab..dedc2f95a40e 100644
--- a/sw/qa/uitest/fieldDialog/tdf135377.py
+++ b/sw/qa/uitest/fieldDialog/tdf135377.py
@@ -16,7 +16,7 @@ class Tdf135377(UITestCase):
 
     def test_tdf135377(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as writer_doc:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", 
close_button="cancel") as xDialog:
                 xTab = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/fieldDialog/tdf143483.py 
b/sw/qa/uitest/fieldDialog/tdf143483.py
index 346fe60743db..357c283badbf 100644
--- a/sw/qa/uitest/fieldDialog/tdf143483.py
+++ b/sw/qa/uitest/fieldDialog/tdf143483.py
@@ -8,7 +8,6 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 
 class Tdf143483(UITestCase):
diff --git a/sw/qa/uitest/fieldDialog/tdf146462.py 
b/sw/qa/uitest/fieldDialog/tdf146462.py
index 95eae5ac0fed..076b274dd7d0 100644
--- a/sw/qa/uitest/fieldDialog/tdf146462.py
+++ b/sw/qa/uitest/fieldDialog/tdf146462.py
@@ -8,7 +8,6 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, type_text
 from uitest.uihelper.common import select_pos
 
@@ -16,7 +15,7 @@ class Tdf146462(UITestCase):
 
     def test_tdf146462(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
diff --git a/sw/qa/uitest/fieldDialog/tdf148551.py 
b/sw/qa/uitest/fieldDialog/tdf148551.py
index 2d0de314b65a..7a052aeff5c5 100644
--- a/sw/qa/uitest/fieldDialog/tdf148551.py
+++ b/sw/qa/uitest/fieldDialog/tdf148551.py
@@ -8,8 +8,7 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict, type_text
+from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_pos
 
 class Tdf148551(UITestCase):
@@ -17,8 +16,6 @@ class Tdf148551(UITestCase):
     def test_tdf148551(self):
 
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", 
close_button="cancel") as xDialog:
                 xTab = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/findReplace/findReplace.py 
b/sw/qa/uitest/findReplace/findReplace.py
index d5cc19847ded..b4a3f9948bd6 100644
--- a/sw/qa/uitest/findReplace/findReplace.py
+++ b/sw/qa/uitest/findReplace/findReplace.py
@@ -121,7 +121,6 @@ class findReplace(UITestCase):
         #tdf116242  ţ ț
     def test_tdf116242_replace_t_with_cedilla(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", 
close_button="close") as xDialog:
                 searchterm = xDialog.getChild("searchterm")
@@ -139,7 +138,7 @@ class findReplace(UITestCase):
 
         #Bug 98417 - FIND & REPLACE: Add 'Find Previous' button
     def test_tdf98417_find_previous_writer(self):
-        with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) 
as writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", 
close_button="close") as xDialog:
diff --git a/sw/qa/uitest/findReplace/findSimilarity.py 
b/sw/qa/uitest/findReplace/findSimilarity.py
index 7c532cc20c16..f12dcaea27aa 100644
--- a/sw/qa/uitest/findReplace/findSimilarity.py
+++ b/sw/qa/uitest/findReplace/findSimilarity.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 
 class findSimilarities(UITestCase):
     def test_find_similarities(self):
-        with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) 
as writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
             #verify: we are on page 1
diff --git a/sw/qa/uitest/findReplace/tdf106099.py 
b/sw/qa/uitest/findReplace/tdf106099.py
index 39f95faad7fd..64fd4831f97d 100644
--- a/sw/qa/uitest/findReplace/tdf106099.py
+++ b/sw/qa/uitest/findReplace/tdf106099.py
@@ -16,7 +16,6 @@ from uitest.uihelper.common import get_state_as_dict
 class tdf106099(UITestCase):
     def test_tdf106099_find_format_underline(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #Find and replace
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", 
close_button="close") as xDialog:
                 #2. Choose Format
diff --git a/sw/qa/uitest/findReplace/tdf118208.py 
b/sw/qa/uitest/findReplace/tdf118208.py
index d0562435287e..aadc50eca059 100644
--- a/sw/qa/uitest/findReplace/tdf118208.py
+++ b/sw/qa/uitest/findReplace/tdf118208.py
@@ -17,7 +17,6 @@ class tdf118208(UITestCase):
 
     def test_tdf118208_search_dialog_format_crash(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             # 1. Open the attached file.
             # 2. Press ctrl-H to show the search and replace dialog.
             # 3. Press the "Format..."  button.
diff --git a/sw/qa/uitest/findReplace/tdf119462.py 
b/sw/qa/uitest/findReplace/tdf119462.py
index ff11f044e5eb..ce0aa9a6b2da 100644
--- a/sw/qa/uitest/findReplace/tdf119462.py
+++ b/sw/qa/uitest/findReplace/tdf119462.py
@@ -16,7 +16,6 @@ from uitest.uihelper.common import get_state_as_dict
 class tdf119462(UITestCase):
     def test_tdf119462_find_format(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #1. Choose Edit > Find and Replace
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", 
close_button="close") as xDialog:
                 #2. Choose Format
diff --git a/sw/qa/uitest/findReplace/tdf137737.py 
b/sw/qa/uitest/findReplace/tdf137737.py
index b2abf3f95acb..6e24a2ced4e7 100644
--- a/sw/qa/uitest/findReplace/tdf137737.py
+++ b/sw/qa/uitest/findReplace/tdf137737.py
@@ -8,15 +8,13 @@
 #
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import type_text, get_url_for_data_file, 
get_state_as_dict
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf137737(UITestCase):
 
     def test_tdf137737(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf137737.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             self.assertEqual(2, writer_doc.Endnotes.Count)
 
diff --git a/sw/qa/uitest/navigator/tdf114724.py 
b/sw/qa/uitest/navigator/tdf114724.py
index 841c9f121423..0ddc9fa11d5a 100644
--- a/sw/qa/uitest/navigator/tdf114724.py
+++ b/sw/qa/uitest/navigator/tdf114724.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf114724(UITestCase):
 
     def test_track_headings_outline(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
index de5da775986c..db864d2d5b18 100644
--- a/sw/qa/uitest/navigator/tdf134960.py
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -37,7 +37,7 @@ class tdf134960_hyperlinks(UITestCase):
 
     def test_tdf134960_hyperlinks(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
@@ -47,7 +47,7 @@ class tdf134960_hyperlinks(UITestCase):
 
     def test_tdf134960_hyperlinks_with_multiple_pages(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
diff --git a/sw/qa/uitest/navigator/tdf140661.py 
b/sw/qa/uitest/navigator/tdf140661.py
index d6c79eb2a00b..da585a9ebc9b 100644
--- a/sw/qa/uitest/navigator/tdf140661.py
+++ b/sw/qa/uitest/navigator/tdf140661.py
@@ -46,7 +46,7 @@ class tdf140661(UITestCase):
 
     def test_tdf140661(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")):
 
             self.launch_navigator(True)
 
diff --git a/sw/qa/uitest/navigator/tdf143569.py 
b/sw/qa/uitest/navigator/tdf143569.py
index 95dbc2dc9a79..e41a1c68053d 100644
--- a/sw/qa/uitest/navigator/tdf143569.py
+++ b/sw/qa/uitest/navigator/tdf143569.py
@@ -15,7 +15,7 @@ class tdf143569(UITestCase):
 
     def test_Tdf143569(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf143569.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf143569.odt")):
 
             xMainWindow = self.xUITest.getTopFocusWindow()
             xWriterEdit = xMainWindow.getChild("writer_edit")
diff --git a/sw/qa/uitest/navigator/tdf144672.py 
b/sw/qa/uitest/navigator/tdf144672.py
index 5d64d63b22ca..fdef04ca37dc 100644
--- a/sw/qa/uitest/navigator/tdf144672.py
+++ b/sw/qa/uitest/navigator/tdf144672.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf144672(UITestCase):
 
     def test_Tdf144672(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf144672.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf144672.odt")):
 
             xMainWindow = self.xUITest.getTopFocusWindow()
             xWriterEdit = xMainWindow.getChild("writer_edit")
diff --git a/sw/qa/uitest/options/tdf78133.py b/sw/qa/uitest/options/tdf78133.py
index 6223c307de3b..d1d504523a90 100644
--- a/sw/qa/uitest/options/tdf78133.py
+++ b/sw/qa/uitest/options/tdf78133.py
@@ -16,8 +16,7 @@ class tdf78133(UITestCase):
 
     def test_tdf78133_options_app_colors(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
             #New text document
             #open option, go to App colors
             with 
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as 
xDialog:
diff --git a/sw/qa/uitest/sidebar/tdf99711.py b/sw/qa/uitest/sidebar/tdf99711.py
index 8e4343741795..af6cd972ddd6 100644
--- a/sw/qa/uitest/sidebar/tdf99711.py
+++ b/sw/qa/uitest/sidebar/tdf99711.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import change_measurement_unit
 class tdf99711(UITestCase):
     def test_tdf99711(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("shape.odt")):
 
             #set measurement to millimeters
             change_measurement_unit(self, "Millimeter")
diff --git a/sw/qa/uitest/styleInspector/styleInspector.py 
b/sw/qa/uitest/styleInspector/styleInspector.py
index f5ce2cd6bc75..5863c295df4d 100644
--- a/sw/qa/uitest/styleInspector/styleInspector.py
+++ b/sw/qa/uitest/styleInspector/styleInspector.py
@@ -9,7 +9,7 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from com.sun.star.rdf.URIs import RDF_TYPE, RDFS_COMMENT, RDFS_LABEL, 
ODF_PREFIX, ODF_SUFFIX, LO_EXT_SHADING
+from com.sun.star.rdf.URIs import LO_EXT_SHADING
 
 class styleNavigator(UITestCase):
 
diff --git a/sw/qa/uitest/table/sheetToTable.py 
b/sw/qa/uitest/table/sheetToTable.py
index e90f65e9fa3f..11b9fe89b490 100644
--- a/sw/qa/uitest/table/sheetToTable.py
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -15,13 +15,11 @@ from uitest.uihelper.calc import enter_text_to_cell
 
 class sheetToTable(UITestCase):
     def test_sheet_to_table_without_hidden_rows(self):
-        with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as 
calc_doc:
-            xCalcDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")):
             self.xUITest.executeCommand(".uno:SelectAll")
             self.xUITest.executeCommand(".uno:Copy")
 
         with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             self.xUITest.executeCommand(".uno:Paste")
             #verify (don't copy hidden cells)
             self.assertEqual(writer_doc.TextTables.getCount(), 1)
@@ -33,13 +31,11 @@ class sheetToTable(UITestCase):
             self.assertEqual(table.getCellByName("A2").getString(), "3")
 
     def test_tdf138688(self):
-        with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as 
calc_doc:
-            xCalcDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")):
             self.xUITest.executeCommand(".uno:SelectAll")
             self.xUITest.executeCommand(".uno:Copy")
 
         with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             # set numbering in the paragraph after the table
             self.xUITest.executeCommand(".uno:GoDown")
@@ -77,7 +73,6 @@ class sheetToTable(UITestCase):
 
 
         with self.ui_test.load_empty_file("writer") as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             
self.xUITest.executeCommand(".uno:InsertTable?Columns:short=1&Rows:short=4")
 
@@ -106,7 +101,6 @@ class sheetToTable(UITestCase):
             self.xUITest.executeCommand(".uno:Copy")
 
         with self.ui_test.load_empty_file("writer") as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             self.xUITest.executeCommand(".uno:Paste")
 
diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py
index 033c140bbc56..2bfc4ca476ed 100644
--- a/sw/qa/uitest/table/splitTable.py
+++ b/sw/qa/uitest/table/splitTable.py
@@ -14,7 +14,6 @@ from uitest.uihelper.common import get_url_for_data_file
 class splitTable(UITestCase):
     def test_split_table(self):
         with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #go to row 2
             self.xUITest.executeCommand(".uno:GoDown")
             self.xUITest.executeCommand(".uno:GoDown")
@@ -33,7 +32,6 @@ class splitTable(UITestCase):
 
         #dialog Split table, check Custom heading, OK -> verify 2 tables, 1st 
has 2 rows, second has 4 rows
         with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #go to row 2
             self.xUITest.executeCommand(".uno:GoDown")
             self.xUITest.executeCommand(".uno:GoDown")
@@ -51,7 +49,6 @@ class splitTable(UITestCase):
 
         #dialog Split table, check No heading, OK -> verify 2 tables, 1st has 
2 rows, second has 4 rows
         with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #go to row 2
             self.xUITest.executeCommand(".uno:GoDown")
             self.xUITest.executeCommand(".uno:GoDown")
diff --git a/sw/qa/uitest/table/tableProperties.py 
b/sw/qa/uitest/table/tableProperties.py
index c0edf484f4f2..771038e2e3a1 100644
--- a/sw/qa/uitest/table/tableProperties.py
+++ b/sw/qa/uitest/table/tableProperties.py
@@ -17,8 +17,7 @@ from uitest.uihelper.common import change_measurement_unit
 
 class tableProperties(UITestCase):
     def test_table_properties(self):
-        with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")):
 
             change_measurement_unit(self, "Centimeter")
 
diff --git a/sw/qa/uitest/table/tableToText.py 
b/sw/qa/uitest/table/tableToText.py
index 87e116befdda..0816cda7e607 100644
--- a/sw/qa/uitest/table/tableToText.py
+++ b/sw/qa/uitest/table/tableToText.py
@@ -15,7 +15,6 @@ from uitest.uihelper.common import get_url_for_data_file
 class tableToText(UITestCase):
     def test_table_to_text(self):
         with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #dialog Table to text - Tabs; verify
             with 
self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as 
xDialog:
                 tabs = xDialog.getChild("tabs")
diff --git a/sw/qa/uitest/table/tdf115572.py b/sw/qa/uitest/table/tdf115572.py
index ebd42ab0e4f5..6698bfa0c3a4 100644
--- a/sw/qa/uitest/table/tdf115572.py
+++ b/sw/qa/uitest/table/tdf115572.py
@@ -19,7 +19,6 @@ class tdf115572(UITestCase):
 
    def test_tdf115572_table_format_gets_reset_deleting_row(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
@@ -44,7 +43,6 @@ class tdf115572(UITestCase):
 
    def test_tdf115572_table_format_gets_reset_deleting_column(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
diff --git a/sw/qa/uitest/table/tdf115573.py b/sw/qa/uitest/table/tdf115573.py
index 2b2ae0a8a80d..103c5a4c59c2 100644
--- a/sw/qa/uitest/table/tdf115573.py
+++ b/sw/qa/uitest/table/tdf115573.py
@@ -19,7 +19,6 @@ class tdf115573(UITestCase):
 
    def test_tdf115573_Table_loses_formatting_inserting_row_before(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
@@ -44,7 +43,6 @@ class tdf115573(UITestCase):
 
    def test_tdf115573_Table_loses_formatting_inserting_row_after(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
@@ -69,7 +67,6 @@ class tdf115573(UITestCase):
 
    def test_tdf115573_Table_loses_formatting_inserting_column_left(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
@@ -89,7 +86,6 @@ class tdf115573(UITestCase):
 
    def test_tdf115573_Table_loses_formatting_inserting_column_right(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #insert table 2x2
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
                 pass
diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py
index 0e6c1b216beb..0002b4bc616e 100644
--- a/sw/qa/uitest/table/tdf116737.py
+++ b/sw/qa/uitest/table/tdf116737.py
@@ -16,7 +16,6 @@ class tdf116737(UITestCase):
     def test_tdf116737_select_table_style(self):
 
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             #Insert => Insert Table / It's not possible to select a table style
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
diff --git a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py 
b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
index 74bb5d40ff8f..3fe74d0ae4d7 100644
--- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
+++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
@@ -16,8 +16,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf134881(UITestCase):
     def test_tdf134881(self):
-        with 
self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt"))
 as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")):
 
             change_measurement_unit(self, "Centimeter")
 
diff --git a/sw/qa/uitest/table/tdf135693.py b/sw/qa/uitest/table/tdf135693.py
index 90544a228fa2..4ebaaac4ebfc 100644
--- a/sw/qa/uitest/table/tdf135693.py
+++ b/sw/qa/uitest/table/tdf135693.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf135693(UITestCase):
 
     def test_tdf135693(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")):
 
             self.xUITest.getTopFocusWindow()
 
diff --git a/sw/qa/uitest/table/tdf140506.py b/sw/qa/uitest/table/tdf140506.py
index 220f46bf662a..4c2759b9e62f 100644
--- a/sw/qa/uitest/table/tdf140506.py
+++ b/sw/qa/uitest/table/tdf140506.py
@@ -9,16 +9,12 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import select_pos
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf140506(UITestCase):
 
     def test_tdf140506(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf140506.odt")) as 
writer_doc:
 
-            xMainWindow = self.xUITest.getTopFocusWindow()
-            xwriter_edit = xMainWindow.getChild("writer_edit")
-
             tables = writer_doc.getTextTables()
             self.assertEqual(len(tables[0].getRows()), 20)
             self.assertEqual(len(tables[0].getColumns()), 2)
diff --git a/sw/qa/uitest/table/tdf146145.py b/sw/qa/uitest/table/tdf146145.py
index 357ce82a45f7..0d293b83207f 100644
--- a/sw/qa/uitest/table/tdf146145.py
+++ b/sw/qa/uitest/table/tdf146145.py
@@ -8,7 +8,7 @@
 #
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_url_for_data_file
 import time
 
 from com.sun.star.accessibility.AccessibleStateType import ENABLED
diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py
index 324be1d7f12d..03cd96d84310 100644
--- a/sw/qa/uitest/table/tdf81292.py
+++ b/sw/qa/uitest/table/tdf81292.py
@@ -16,7 +16,6 @@ class tdf81292(UITestCase):
 
    def test_tdf81292_table_sort(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #select whole table
             self.xUITest.executeCommand(".uno:SelectTable")
             #Tools - Sort
diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py
index 0f5e55b3047b..9015b72c5c77 100644
--- a/sw/qa/uitest/table/tdf99334.py
+++ b/sw/qa/uitest/table/tdf99334.py
@@ -16,7 +16,6 @@ class tdf99334(UITestCase):
 
    def test_tdf99334_table_sort_umlauts(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #select whole table
             self.xUITest.executeCommand(".uno:SelectTable")
             #Tools - Sort
diff --git a/sw/qa/uitest/table/textToTable.py 
b/sw/qa/uitest/table/textToTable.py
index 06d4b02da843..5b70b89cc978 100644
--- a/sw/qa/uitest/table/textToTable.py
+++ b/sw/qa/uitest/table/textToTable.py
@@ -36,8 +36,6 @@ class textToTable(UITestCase):
 
     def test_text_to_table_header(self):
         with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
             #open file; select all text ; dialog Text to table - other ":"; 
verify
             self.xUITest.executeCommand(".uno:SelectAll")
             with 
self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") as 
xDialog:
diff --git a/sw/qa/uitest/ui/fmtui/fmtui.py b/sw/qa/uitest/ui/fmtui/fmtui.py
index f94784702362..87f325083715 100644
--- a/sw/qa/uitest/ui/fmtui/fmtui.py
+++ b/sw/qa/uitest/ui/fmtui/fmtui.py
@@ -18,7 +18,6 @@ class TestTmpdlg(UITestCase):
     def test_para_style_semi_transparent_text(self):
 
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             with self.ui_test.execute_dialog_through_command(".uno:EditStyle", 
close_button="cancel") as xDialog:
 
                 xTabs = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/uibase/shells/shells.py 
b/sw/qa/uitest/uibase/shells/shells.py
index e422c012a322..a1de003f155b 100644
--- a/sw/qa/uitest/uibase/shells/shells.py
+++ b/sw/qa/uitest/uibase/shells/shells.py
@@ -16,7 +16,7 @@ import time
 class TestSwGrfShell(UITestCase):
     def testFormatGraphicDlg(self):
         # Given a document with an image with a relative size:
-        with 
self.ui_test.load_file(get_url_for_data_file("image-rel-size.fodt")) as 
component:
+        with 
self.ui_test.load_file(get_url_for_data_file("image-rel-size.fodt")):
             self.xUITest.executeCommand(".uno:JumpToNextFrame")
             # 120 ms in the SwView ctor
             time.sleep(0.2)
diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py 
b/sw/qa/uitest/writer_tests/compareDocuments.py
index 55cbdd047fc4..f2575f5ec906 100644
--- a/sw/qa/uitest/writer_tests/compareDocuments.py
+++ b/sw/qa/uitest/writer_tests/compareDocuments.py
@@ -16,9 +16,7 @@ class compareDocuments(UITestCase):
 
     def test_tdf130960(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) as 
writer_doc:
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", 
close_button="") as xOpenDialog:
                 xFileName = xOpenDialog.getChild("file_name")
@@ -40,9 +38,7 @@ class compareDocuments(UITestCase):
 
     def test_tdf137855(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")) as 
writer_doc:
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", 
close_button="") as xOpenDialog:
 
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py 
b/sw/qa/uitest/writer_tests/insertCaption.py
index 5831f3cf34c3..e2ed71e2459e 100644
--- a/sw/qa/uitest/writer_tests/insertCaption.py
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -34,8 +34,6 @@ class insertCaption(UITestCase):
                 xCapt.executeAction("TYPE", 
mkPropertyValues({"TEXT":"Caption"}))
 
 
-            xFrame = document.TextFrames[0]
-
             
self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), 
"\nText 1: Caption")
 
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as 
xDialogCaption:
diff --git a/sw/qa/uitest/writer_tests/tdf134734.py 
b/sw/qa/uitest/writer_tests/tdf134734.py
index 4497649f695e..44edf6c1af5c 100644
--- a/sw/qa/uitest/writer_tests/tdf134734.py
+++ b/sw/qa/uitest/writer_tests/tdf134734.py
@@ -8,10 +8,8 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, select_pos
 from com.sun.star.drawing.FillStyle import SOLID
-import importlib
 
 class TestClass(UITestCase):
     def test_master_page_background(self):
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py 
b/sw/qa/uitest/writer_tests/tdf81457.py
index ff021a4f7ee4..8928a2a96b09 100644
--- a/sw/qa/uitest/writer_tests/tdf81457.py
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -15,7 +15,7 @@ class tdf81457(UITestCase):
 
 #tdf 81457
    def test_open_documentProperties_tdf81457(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")):
             with 
self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as 
xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "2")     #tab Custom properties
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py 
b/sw/qa/uitest/writer_tests/trackedChanges.py
index e6ed8c67d20b..3225a74f6e08 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -19,7 +19,7 @@ class trackedchanges(UITestCase):
 
     def test_tdf91270(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
@@ -133,8 +133,6 @@ class trackedchanges(UITestCase):
 
     def test_list_of_changes(self):
         with 
self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             listText = [
                     "Unknown Author\t01/24/2020 16:19:32\t",
@@ -197,8 +195,6 @@ class trackedchanges(UITestCase):
 
     def test_tdf135018(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")) as 
document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             self.assertEqual(5, document.CurrentController.PageCount)
 
@@ -223,8 +219,6 @@ class trackedchanges(UITestCase):
 
     def test_tdf144270_tracked_table_rows(self):
         with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             tables = document.getTextTables()
             self.assertEqual(3, len(tables))
@@ -328,10 +322,7 @@ class trackedchanges(UITestCase):
 
     def test_tdf148032(self):
 
-        with 
self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
+        with 
self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")):
 
             # adding new Comment
             self.xUITest.executeCommand(".uno:InsertAnnotation")
diff --git a/sw/qa/uitest/writer_tests/versionDialog.py 
b/sw/qa/uitest/writer_tests/versionDialog.py
index 5f34de51180d..90c1de189048 100644
--- a/sw/qa/uitest/writer_tests/versionDialog.py
+++ b/sw/qa/uitest/writer_tests/versionDialog.py
@@ -14,9 +14,7 @@ class versionDialog(UITestCase):
 
     def test_tdf131931(self):
 
-        with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) as 
writer_doc:
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:VersionDialog", 
close_button="close") as xVersionDialog:
 
diff --git a/sw/qa/uitest/writer_tests/watermark.py 
b/sw/qa/uitest/writer_tests/watermark.py
index 1ba46cecc796..af369660f197 100644
--- a/sw/qa/uitest/writer_tests/watermark.py
+++ b/sw/qa/uitest/writer_tests/watermark.py
@@ -16,7 +16,6 @@ class watermark(UITestCase):
 
    def test_insert_watermark(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with self.ui_test.execute_dialog_through_command(".uno:Watermark") 
as xDialog:
                 xTextInput = xDialog.getChild("TextInput")
diff --git a/sw/qa/uitest/writer_tests/wordCount.py 
b/sw/qa/uitest/writer_tests/wordCount.py
index c1e816337d5b..06d62fefb88a 100644
--- a/sw/qa/uitest/writer_tests/wordCount.py
+++ b/sw/qa/uitest/writer_tests/wordCount.py
@@ -15,7 +15,7 @@ class writerWordCount(UITestCase):
 
     def test_word_count_dialog(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
@@ -45,7 +45,7 @@ class writerWordCount(UITestCase):
 
     def test_tdf68347(self):
         #Bug 68347 - Incorrect word count in a document with recorded changes
-        with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
 
@@ -57,7 +57,6 @@ class writerWordCount(UITestCase):
                 xselectchars = xDialog.getChild("selectchars")
                 xdocchars = xDialog.getChild("docchars")
                 xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
-                xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
                 xselectcjkchars = xDialog.getChild("selectcjkchars")
                 xdoccjkchars = xDialog.getChild("doccjkchars")
 
@@ -72,14 +71,13 @@ class writerWordCount(UITestCase):
                 self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
 
     def test_tdf91100(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", 
close_button="close"):
                 pass
 
     def test_tdf58050(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")):
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", 
close_button="close") as xDialog:
 
@@ -103,7 +101,7 @@ class writerWordCount(UITestCase):
 
     def test_word_count_interpunction_counted_tdf56975_a(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
             #Open writer, enter "Testing one two! Test?"
@@ -132,7 +130,7 @@ class writerWordCount(UITestCase):
 
     def test_word_count_interpunction_counted_tdf56975_b(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
             #1. Create a new text document.
@@ -208,20 +206,13 @@ class writerWordCount(UITestCase):
                 self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
 
     def test_tdf51816(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
+        with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")):
             #1. Open attached document
             #2. Tools> Word count
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", 
close_button="close") as xDialog:
                 xselectwords = xDialog.getChild("selectwords")
-                xdocwords = xDialog.getChild("docwords")
                 xselectchars = xDialog.getChild("selectchars")
-                xdocchars = xDialog.getChild("docchars")
                 xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
-                xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
-                xselectcjkchars = xDialog.getChild("selectcjkchars")
-                xdoccjkchars = xDialog.getChild("doccjkchars")
 
                 #3. Click after "At nunc" then <Ctrl><Shift><Left>
                 self.xUITest.executeCommand(".uno:GoRight")
diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py 
b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
index 7302dd89ed1d..962bd293e23d 100644
--- a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
+++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
@@ -15,7 +15,6 @@ class asianPhoneticGuide(UITestCase):
 
    def test_asian_phonetic_guide(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog", 
close_button="close") as xDialog:
 
diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py 
b/sw/qa/uitest/writer_tests2/deleteAllComments.py
index e655a2f8a23d..aba2d9d2596b 100644
--- a/sw/qa/uitest/writer_tests2/deleteAllComments.py
+++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py
@@ -25,7 +25,6 @@ class DeleteAllComments(UITestCase):
 
             self.xUITest.executeCommand(".uno:SelectAll")
             self.xUITest.executeCommand(".uno:InsertAnnotation")
-            cursor = document.getCurrentController().getViewCursor()
             type_text(xWriterEdit, "EEEEE")
             self.xUITest.executeCommand(".uno:InsertAnnotation")
             self.xUITest.executeCommand(".uno:DeleteAllNotes")
@@ -34,7 +33,7 @@ class DeleteAllComments(UITestCase):
 
     def test_comment_trackchanges(self):
 #tdf111524
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
diff --git a/sw/qa/uitest/writer_tests2/fontworks.py 
b/sw/qa/uitest/writer_tests2/fontworks.py
index a70fc297b71a..60db9022ef65 100644
--- a/sw/qa/uitest/writer_tests2/fontworks.py
+++ b/sw/qa/uitest/writer_tests2/fontworks.py
@@ -16,8 +16,6 @@ class fontWorksDialog(UITestCase):
 
     def test_fontwork_selector(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontworkGalleryFloater", 
close_button="cancel") as xDialog:
                 FontWorkSelector = xDialog.getChild("ctlFavoriteswin")
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py 
b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
index 4892dde49a1f..1b993cb95d16 100644
--- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -19,7 +19,6 @@ class formatBulletsNumbering(UITestCase):
 
    def test_bullets_and_numbering_dialog_tab_position(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Millimeter")
 
@@ -54,7 +53,6 @@ class formatBulletsNumbering(UITestCase):
 
    def test_bullets_and_numbering_dialog_tab_position2(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") 
as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -73,7 +71,6 @@ class formatBulletsNumbering(UITestCase):
 
    def test_bullets_and_numbering_dialog_tab_customize(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") 
as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -167,7 +164,6 @@ class formatBulletsNumbering(UITestCase):
 
    def test_bullets_and_numbering_button_move(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Millimeter")
 
@@ -197,7 +193,6 @@ class formatBulletsNumbering(UITestCase):
 
    def test_bullets_and_numbering_selection(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             # Test Bullet Page
             with 
self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") 
as xDialog:
diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py 
b/sw/qa/uitest/writer_tests2/formatCharacter.py
index 196313368134..86efd640dbb4 100644
--- a/sw/qa/uitest/writer_tests2/formatCharacter.py
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -17,8 +17,7 @@ from uitest.uihelper.common import select_by_text
 class formatCharacter(UITestCase):
 
    def test_format_character_tab_font(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -69,8 +68,7 @@ class formatCharacter(UITestCase):
 
 
    def test_format_character_tab_font_effects(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -121,7 +119,6 @@ class formatCharacter(UITestCase):
 
    def test_format_character_tab_hyperlink(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -160,8 +157,7 @@ class formatCharacter(UITestCase):
 
 
    def test_format_character_tab_asian_layout(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -179,8 +175,7 @@ class formatCharacter(UITestCase):
                 self.assertEqual(get_state_as_dict(xTwolines)["Selected"], 
"true")
 
    def test_format_character_tab_position(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -224,8 +219,7 @@ class formatCharacter(UITestCase):
 
 
    def test_format_character_tab_position_scalewidthsb(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py 
b/sw/qa/uitest/writer_tests2/formatParagraph.py
index 14882dc6b5f1..5756c92e64c1 100644
--- a/sw/qa/uitest/writer_tests2/formatParagraph.py
+++ b/sw/qa/uitest/writer_tests2/formatParagraph.py
@@ -19,7 +19,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_indents_spacing(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -73,7 +72,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_alignment(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -116,7 +114,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_text_flow(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -187,7 +184,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_asian_typography(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -218,7 +214,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_outline_numbering(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -253,7 +248,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_tabs(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Centimeter")
 
@@ -366,7 +360,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_drop_caps(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -406,7 +399,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_tab_borders(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Centimeter")
 
@@ -414,7 +406,6 @@ class formatParagraph(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "7")
 
-                xStyle = xDialog.getChild("linestylelb")
                 xwidth = xDialog.getChild("linewidthmf")
                 xSync = xDialog.getChild("sync")
                 xLeft = xDialog.getChild("leftmf")
@@ -437,7 +428,6 @@ class formatParagraph(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "7")
 
-                xStyle = xDialog.getChild("linestylelb")
                 xwidth = xDialog.getChild("linewidthmf")
                 xSync = xDialog.getChild("sync")
                 xLeft = xDialog.getChild("leftmf")
@@ -456,7 +446,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_area(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", 
close_button="cancel") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -476,7 +465,6 @@ class formatParagraph(UITestCase):
 
    def test_format_paragraph_transparency(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py 
b/sw/qa/uitest/writer_tests2/tdf116474.py
index dca0e790a393..f24746c12280 100644
--- a/sw/qa/uitest/writer_tests2/tdf116474.py
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -17,7 +17,6 @@ class tdf116474(UITestCase):
 
    def test_tdf116474_insert_caption_undo(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             text = document.getText()
             cursor = text.createTextCursor()
             textGraphic = 
document.createInstance('com.sun.star.text.TextGraphicObject')
@@ -34,7 +33,6 @@ class tdf116474(UITestCase):
                 xCapt.executeAction("TYPE", 
mkPropertyValues({"TEXT":"Caption"}))
 
 
-            xFrame = document.TextFrames[0]
             self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: 
Caption")
             self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of 
images
             #Undo, redo
diff --git a/sw/qa/uitest/writer_tests2/tdf146375.py 
b/sw/qa/uitest/writer_tests2/tdf146375.py
index e22e6c4d3dc2..7abc7db85215 100644
--- a/sw/qa/uitest/writer_tests2/tdf146375.py
+++ b/sw/qa/uitest/writer_tests2/tdf146375.py
@@ -16,7 +16,7 @@ import string
 class Tdf146375(UITestCase):
 
    def test_tdf146375(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             count = 0
             # Use a random name
diff --git a/sw/qa/uitest/writer_tests3/goToPage.py 
b/sw/qa/uitest/writer_tests3/goToPage.py
index 4b763eeca2bf..812402f89c57 100644
--- a/sw/qa/uitest/writer_tests3/goToPage.py
+++ b/sw/qa/uitest/writer_tests3/goToPage.py
@@ -14,7 +14,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class GoToPage_dialog(UITestCase):
 
    def test_go_to_page(self):
-    with self.ui_test.load_file(get_url_for_data_file("3pages.odt")) as 
writer_doc:
+    with self.ui_test.load_file(get_url_for_data_file("3pages.odt")):
         xWriterDoc = self.xUITest.getTopFocusWindow()
         xWriterEdit = xWriterDoc.getChild("writer_edit")
 
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py 
b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
index c737f33ad1b8..4494ab45a14c 100644
--- a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -19,7 +19,6 @@ class HyperlinkDialog(UITestCase):
     def test_hyperlink_dialog_vertical_tab(self):
 
         with self.ui_test.create_doc_in_start_center("writer"):
-            MainWindow = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", 
close_button="cancel") as xDialog:
 
@@ -109,8 +108,6 @@ class HyperlinkDialog(UITestCase):
             return
 
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             with 
self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", 
close_button="") as xDialog:
                 xHelp = xDialog.getChild("help")
diff --git a/sw/qa/uitest/writer_tests3/insertEnvelope.py 
b/sw/qa/uitest/writer_tests3/insertEnvelope.py
index 0a91780a10c6..eddce821b405 100644
--- a/sw/qa/uitest/writer_tests3/insertEnvelope.py
+++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py
@@ -20,7 +20,6 @@ class WriterInsertEnvelope(UITestCase):
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope", 
close_button="user") as xDialog:
                 xAddrTxt= xDialog.getChild("addredit")
                 xSenderTxt = xDialog.getChild("senderedit")
-                xSenderCheckBox = xDialog.getChild("sender")
 
                 xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": 
"1", "TO": "200"}))
                 xAddrTxt.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py 
b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
index f2fbc3559fb3..d9ca31f36e38 100644
--- a/sw/qa/uitest/writer_tests3/insertFootEndnote.py
+++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
@@ -14,7 +14,6 @@ class insertFootEndnote(UITestCase):
 
    def test_insert_foot_endnote(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
 #Automatic - Footnote
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
diff --git a/sw/qa/uitest/writer_tests3/insertPageFooter.py 
b/sw/qa/uitest/writer_tests3/insertPageFooter.py
index 3a5c6a13ee4a..577c33ab6b55 100644
--- a/sw/qa/uitest/writer_tests3/insertPageFooter.py
+++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py
@@ -37,7 +37,7 @@ class WriterInsertPageFooter(UITestCase):
             document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
 
     def test_footer(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             self.insert_footer()
 
diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py 
b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
index 5895211af123..241d87eccdbc 100644
--- a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
+++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
@@ -14,7 +14,6 @@ class insertQrCode(UITestCase):
 
    def test_insert_qr_code(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog:
 
diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py 
b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
index 0082891dab1a..03e87daf2ffe 100644
--- a/sw/qa/uitest/writer_tests3/insertSignatureLine.py
+++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
@@ -14,7 +14,6 @@ class insertSignatureLine(UITestCase):
 
    def test_insert_signature_line(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             # set the signature line
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as 
xDialog:
diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py 
b/sw/qa/uitest/writer_tests3/pageDialog.py
index 18bc1c999355..f0011ed69f94 100644
--- a/sw/qa/uitest/writer_tests3/pageDialog.py
+++ b/sw/qa/uitest/writer_tests3/pageDialog.py
@@ -209,7 +209,7 @@ class WriterPageDialog(UITestCase):
     def test_cancel_button_page_dialog(self):
         with self.ui_test.create_doc_in_start_center("writer"):
 
-            with 
self.ui_test.execute_dialog_through_command(".uno:PageDialog", 
close_button="cancel") as xDialog:
+            with 
self.ui_test.execute_dialog_through_command(".uno:PageDialog", 
close_button="cancel"):
                 pass
 
 
diff --git a/sw/qa/uitest/writer_tests3/sort.py 
b/sw/qa/uitest/writer_tests3/sort.py
index aafe7a00c6a5..e34588afa6e6 100644
--- a/sw/qa/uitest/writer_tests3/sort.py
+++ b/sw/qa/uitest/writer_tests3/sort.py
@@ -47,7 +47,6 @@ class WriterSort(UITestCase):
             #Tools - Sort
             with 
self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog:
                 xDown = xDialog.getChild("down1")
-                xcolsb1 = xDialog.getChild("colsb1")
                 xtypelb1 = xDialog.getChild("typelb1")
                 xcharacter = xDialog.getChild("character")
                 xseparator = xDialog.getChild("separator")
diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py 
b/sw/qa/uitest/writer_tests3/specialCharacter.py
index c9e4299f2c1d..02a105835c44 100644
--- a/sw/qa/uitest/writer_tests3/specialCharacter.py
+++ b/sw/qa/uitest/writer_tests3/specialCharacter.py
@@ -16,7 +16,7 @@ from uitest.uihelper.common import select_pos
 class specialCharacter(UITestCase):
 
     def test_tdf56363(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
             xWriterDoc = self.xUITest.getTopFocusWindow()
 
             # Insert a font including a font feature into the font name 
combobox
@@ -33,10 +33,7 @@ class specialCharacter(UITestCase):
                 self.assertEqual(get_state_as_dict(xComboFont)["Text"], 
fontName)
 
     def test_special_character(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", 
close_button="cancel") as xDialog:
                 xCharSet = xDialog.getChild("showcharset")  # default charset
diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py 
b/sw/qa/uitest/writer_tests4/exportToPDF.py
index e882559484ad..99e20c914efb 100644
--- a/sw/qa/uitest/writer_tests4/exportToPDF.py
+++ b/sw/qa/uitest/writer_tests4/exportToPDF.py
@@ -8,7 +8,7 @@
 #
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import type_text
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from org.libreoffice.unotest import systemPathToFileUrl
diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py 
b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
index 9299d46aa737..4d968f723c8a 100644
--- a/sw/qa/uitest/writer_tests4/insertBreakDialog.py
+++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
@@ -8,7 +8,6 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import select_pos
 
 class WriterInsertBreakDialog(UITestCase):
diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py 
b/sw/qa/uitest/writer_tests4/insertPageHeader.py
index b18efd74241a..6516a31dab4d 100644
--- a/sw/qa/uitest/writer_tests4/insertPageHeader.py
+++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py
@@ -37,7 +37,7 @@ class WriterInsertPageHeader(UITestCase):
             document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
 
     def test_header(self):
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             self.insert_header()
 
diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py 
b/sw/qa/uitest/writer_tests4/tdf122449.py
index 4c4f91e75dfd..dad65e29a7aa 100644
--- a/sw/qa/uitest/writer_tests4/tdf122449.py
+++ b/sw/qa/uitest/writer_tests4/tdf122449.py
@@ -16,7 +16,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf122449(UITestCase):
 
     def test_tdf122449_crash_edit_index_entry(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")):
             xWriterDoc = self.xUITest.getTopFocusWindow()
             xWriterEdit = xWriterDoc.getChild("writer_edit")
             #search word Autocorrect (second find)   .uno:SearchDialog
diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py 
b/sw/qa/uitest/writer_tests4/tdf134439.py
index 7348049d1624..d34c365dc55c 100644
--- a/sw/qa/uitest/writer_tests4/tdf134439.py
+++ b/sw/qa/uitest/writer_tests4/tdf134439.py
@@ -9,7 +9,6 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
 from uitest.uihelper.common import select_by_text
-from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf134439(UITestCase):
 
diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py 
b/sw/qa/uitest/writer_tests4/tdf138546.py
index 89abcf7da0f9..dedaf36d1ff8 100644
--- a/sw/qa/uitest/writer_tests4/tdf138546.py
+++ b/sw/qa/uitest/writer_tests4/tdf138546.py
@@ -15,7 +15,6 @@ from uitest.uihelper.common import get_url_for_data_file
 class tdf138546(UITestCase):
     def test_tdf138546(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Centimeter")
 
diff --git a/sw/qa/uitest/writer_tests4/tdf148395.py 
b/sw/qa/uitest/writer_tests4/tdf148395.py
index 312733525758..233b4f2363b4 100644
--- a/sw/qa/uitest/writer_tests4/tdf148395.py
+++ b/sw/qa/uitest/writer_tests4/tdf148395.py
@@ -10,7 +10,6 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict
-from uitest.uihelper.common import select_pos
 
 class Tdf148395(UITestCase):
 
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py 
b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
index 9eb36eefb768..7eaa7b255247 100644
--- a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -13,8 +13,7 @@ class dateFormFieldDialog(UITestCase):
 
     def test_setting_date_format(self):
         # open a file with a date form field
-        with 
self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")):
 
             # open the dialog (cursor is at the field)
             with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
@@ -38,8 +37,7 @@ class dateFormFieldDialog(UITestCase):
 
     def test_date_field_with_custom_format(self):
         # open a file with a date form field
-        with 
self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt"))
 as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")):
 
             # open the dialog (cursor is at the field)
             with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
@@ -61,7 +59,6 @@ class dateFormFieldDialog(UITestCase):
     def test_date_reformat(self):
         # open a file with a date form field
         with 
self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             self.assertEqual(writer_doc.getText().getString(), "07/17/19")
 
             # open the dialog (cursor is at the field)
@@ -84,7 +81,6 @@ class dateFormFieldDialog(UITestCase):
     def test_date_field_with_placeholder(self):
         # open a file with a date form field
         with 
self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt"))
 as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             self.assertEqual(writer_doc.getText().getString(), "[select date]")
 
             # open the dialog (cursor is at the field)
@@ -110,7 +106,6 @@ class dateFormFieldDialog(UITestCase):
 
         # open a file with a date form field
         with 
self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt"))
 as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             self.assertEqual(writer_doc.getText().getString(), "07/17/19")
 
             # open the dialog (cursor is at the field)
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py 
b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
index e64e32b02b3c..c68bc8a73ee0 100644
--- a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -15,8 +15,7 @@ class dropDownFormFieldDialog(UITestCase):
     def test_add_new_items(self):
 
         # open a file with an empty form field
-        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
 
             # open the dialog (cursor is at the field)
             with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
@@ -64,8 +63,7 @@ class dropDownFormFieldDialog(UITestCase):
     def test_remove_items(self):
 
         # open a file with an empty form field
-        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
 
             # open the dialog (cursor is at the field)
             with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
@@ -134,8 +132,7 @@ class dropDownFormFieldDialog(UITestCase):
     def test_move_items(self):
 
         # open a file with an empty form field
-        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) 
as writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
+        with 
self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")):
 
             # open the dialog (cursor is at the field)
             with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
@@ -217,8 +214,7 @@ class dropDownFormFieldDialog(UITestCase):
         files = ["drop_down_form_field.odt", "drop_down_form_field.doc", 
"drop_down_form_field.docx"]
         for file in files:
             # open a file with a drop-down for field with items and selection
-            with self.ui_test.load_file(get_url_for_data_file(file)) as 
writer_doc:
-                xWriterDoc = self.xUITest.getTopFocusWindow()
+            with self.ui_test.load_file(get_url_for_data_file(file)):
 
                 # open the dialog (cursor is at the field)
                 with 
self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as 
xDialog:
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py 
b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
index a1305018ed03..d891a0d99faf 100644
--- a/sw/qa/uitest/writer_tests5/autocorrectOptions.py
+++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
@@ -16,7 +16,6 @@ class autocorrectOptions(UITestCase):
 
    def test_autocorrect_options_writer(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", 
close_button="cancel") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
@@ -26,7 +25,6 @@ class autocorrectOptions(UITestCase):
                 xnew = xDialog.getChild("new")
                 xdelete = xDialog.getChild("delete")
                 xtabview = xDialog.getChild("tabview")
-                xreset = xDialog.getChild("reset")
                 nrRows = get_state_as_dict(xtabview)["VisibleCount"]
 
                 self.assertTrue(int(nrRows) > 0)
diff --git a/sw/qa/uitest/writer_tests5/columns.py 
b/sw/qa/uitest/writer_tests5/columns.py
index a70f31143fd6..223534930a0e 100644
--- a/sw/qa/uitest/writer_tests5/columns.py
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -15,7 +15,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 class columns(UITestCase):
     def test_columns(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             change_measurement_unit(self, "Centimeter")
 
diff --git a/sw/qa/uitest/writer_tests5/tdf106899.py 
b/sw/qa/uitest/writer_tests5/tdf106899.py
index bd77c29457c8..3a81913e96ac 100644
--- a/sw/qa/uitest/writer_tests5/tdf106899.py
+++ b/sw/qa/uitest/writer_tests5/tdf106899.py
@@ -17,7 +17,6 @@ class tdf106899(UITestCase):
         # Copy concordance file containing an utf8 index entry
         org.libreoffice.unotest.makeCopyFromTDOC("tdf106899.sdi")
         with self.ui_test.load_file(get_url_for_data_file("tdf106899.odt")) as 
document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             # Update the alphabetical index and check if it contains the utf8 
index entry
             xDocumentIndexes = document.DocumentIndexes
diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py 
b/sw/qa/uitest/writer_tests5/tdf122045.py
index 6e938e09345f..a43c6b378cb7 100644
--- a/sw/qa/uitest/writer_tests5/tdf122045.py
+++ b/sw/qa/uitest/writer_tests5/tdf122045.py
@@ -15,7 +15,6 @@ class tdf122045(UITestCase):
     def test_tdf122045(self):
 
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:PageDialog", 
close_button="cancel") as xDialog:
 
diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py 
b/sw/qa/uitest/writer_tests5/tdf122722.py
index ebbbd18dbb96..f58c32b83ebe 100644
--- a/sw/qa/uitest/writer_tests5/tdf122722.py
+++ b/sw/qa/uitest/writer_tests5/tdf122722.py
@@ -33,14 +33,7 @@ class tdf122722(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "1")
 
-                xEffects = xDialog.getChild("effectslb")
-                xRelief = xDialog.getChild("relieflb")
                 xHidden = xDialog.getChild("hiddencb")
-                xOverline = xDialog.getChild("overlinelb")
-                xStrikeout = xDialog.getChild("strikeoutlb")
-                xUnderline = xDialog.getChild("underlinelb")
-                xEmphasis = xDialog.getChild("emphasislb")
-                xPosition = xDialog.getChild("positionlb")
 
                 xHidden.executeAction("CLICK", tuple())
 
@@ -49,14 +42,7 @@ class tdf122722(UITestCase):
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "1")
 
-                xEffects = xDialog.getChild("effectslb")
-                xRelief = xDialog.getChild("relieflb")
                 xHidden = xDialog.getChild("hiddencb")
-                xOverline = xDialog.getChild("overlinelb")
-                xStrikeout = xDialog.getChild("strikeoutlb")
-                xUnderline = xDialog.getChild("underlinelb")
-                xEmphasis = xDialog.getChild("emphasislb")
-                xPosition = xDialog.getChild("positionlb")
 
                 self.assertEqual(get_state_as_dict(xHidden)["Selected"], 
"true")
                 xHidden.executeAction("CLICK", tuple())
diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py 
b/sw/qa/uitest/writer_tests5/tdf123378.py
index b0b35d26648d..ba58d0f64e4a 100644
--- a/sw/qa/uitest/writer_tests5/tdf123378.py
+++ b/sw/qa/uitest/writer_tests5/tdf123378.py
@@ -16,7 +16,6 @@ class tdf123378(UITestCase):
         # FIXME unstable test
         return
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             self.xUITest.executeCommand(".uno:Print")
             xDialog = self.xUITest.getTopFocusWindow()
diff --git a/sw/qa/uitest/writer_tests5/tdf138531.py 
b/sw/qa/uitest/writer_tests5/tdf138531.py
index 328a8250b266..d2a86864288c 100644
--- a/sw/qa/uitest/writer_tests5/tdf138531.py
+++ b/sw/qa/uitest/writer_tests5/tdf138531.py
@@ -16,7 +16,7 @@ class Tdf138531(UITestCase):
 
     def test_tdf138531(self):
 
-        with self.ui_test.create_doc_in_start_center("calc") as document:
+        with self.ui_test.create_doc_in_start_center("calc"):
             xCalcDoc = self.xUITest.getTopFocusWindow()
             gridwin = xCalcDoc.getChild("grid_window")
             #enter data
diff --git a/sw/qa/uitest/writer_tests5/tdf142847.py 
b/sw/qa/uitest/writer_tests5/tdf142847.py
index 845b7eb7a7ca..54cbf8291dbc 100644
--- a/sw/qa/uitest/writer_tests5/tdf142847.py
+++ b/sw/qa/uitest/writer_tests5/tdf142847.py
@@ -7,16 +7,12 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 from uitest.framework import UITestCase
-import org.libreoffice.unotest
 from uitest.uihelper.common import get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf142847(UITestCase):
     def test_tdf142847(self):
         # load the sample file
         with self.ui_test.load_file(get_url_for_data_file("tdf142847.fodt")):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
             document = self.ui_test.get_component()
 
             # get the shape
diff --git a/sw/qa/uitest/writer_tests5/tdf147935.py 
b/sw/qa/uitest/writer_tests5/tdf147935.py
index fa0e773a980d..eef8d143ab9f 100644
--- a/sw/qa/uitest/writer_tests5/tdf147935.py
+++ b/sw/qa/uitest/writer_tests5/tdf147935.py
@@ -8,7 +8,6 @@
 #
 
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.calc import enter_text_to_cell
 
@@ -16,7 +15,7 @@ class Tdf147935(UITestCase):
 
     def test_tdf147935(self):
 
-        with self.ui_test.create_doc_in_start_center("calc") as document:
+        with self.ui_test.create_doc_in_start_center("calc"):
             xCalcDoc = self.xUITest.getTopFocusWindow()
             gridwin = xCalcDoc.getChild("grid_window")
             #enter data
diff --git a/sw/qa/uitest/writer_tests5/tdf148920.py 
b/sw/qa/uitest/writer_tests5/tdf148920.py
index c8bde7769ca9..2125ae587d59 100644
--- a/sw/qa/uitest/writer_tests5/tdf148920.py
+++ b/sw/qa/uitest/writer_tests5/tdf148920.py
@@ -14,7 +14,7 @@ class tdf148920(UITestCase):
 
    def test_tdf148920(self):
 
-        with self.ui_test.create_doc_in_start_center("writer") as document:
+        with self.ui_test.create_doc_in_start_center("writer"):
 
             
self.xUITest.executeCommand(".uno:StyleApply?Style:string=Text%20body&FamilyName:string=ParagraphStyles")
 
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py 
b/sw/qa/uitest/writer_tests5/titlePage.py
index e2b774492f15..3d539e03b24d 100644
--- a/sw/qa/uitest/writer_tests5/titlePage.py
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -12,7 +12,6 @@ from uitest.framework import UITestCase
 class titlePage(UITestCase):
     def test_title_page(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #dialog Title Page
             with 
self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
                 #select new Pages; nr of pages =2 (click UP), save; verify 
pageCount = 3
diff --git a/sw/qa/uitest/writer_tests5/zoom.py 
b/sw/qa/uitest/writer_tests5/zoom.py
index cb6d0ebad955..cbd455e14769 100644
--- a/sw/qa/uitest/writer_tests5/zoom.py
+++ b/sw/qa/uitest/writer_tests5/zoom.py
@@ -14,7 +14,6 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 class writerZoom(UITestCase):
     def test_zoom_writer(self):
         with self.ui_test.create_doc_in_start_center("writer"):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             #dialog View-Zoom-Zoom
             with self.ui_test.execute_dialog_through_command(".uno:Zoom") as 
xDialog:
 
diff --git a/sw/qa/uitest/writer_tests6/save_readonly_with_password.py 
b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
index 5593e852d7ed..46fa527d6d90 100644
--- a/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
+++ b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
@@ -92,8 +92,6 @@ class save_readonly_with_password(UITestCase):
 
             with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as 
document:
 
-                xWriterEdit = 
self.xUITest.getTopFocusWindow().getChild("writer_edit")
-
                 self.assertTrue(document.isReadonly())
 
                 with 
self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py 
b/sw/qa/uitest/writer_tests6/tdf107847.py
index 98fd794a443f..5905cd6d7da4 100644
--- a/sw/qa/uitest/writer_tests6/tdf107847.py
+++ b/sw/qa/uitest/writer_tests6/tdf107847.py
@@ -15,7 +15,6 @@ class tdf107847(UITestCase):
 
    def test_tdf_107847_macro_tab_crash(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             with 
self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py 
b/sw/qa/uitest/writer_tests6/tdf120731.py
index d503fbd6d74a..69546e6249b5 100644
--- a/sw/qa/uitest/writer_tests6/tdf120731.py
+++ b/sw/qa/uitest/writer_tests6/tdf120731.py
@@ -14,7 +14,6 @@ from uitest.uihelper.common import get_url_for_data_file
 class tdf120731(UITestCase):
    def test_tdf120731_crash_open_char_dialog(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             self.xUITest.executeCommand(".uno:SelectAll")
             with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog"):
diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py 
b/sw/qa/uitest/writer_tests6/tdf124586.py
index 27d7867e9221..b98237bf2680 100644
--- a/sw/qa/uitest/writer_tests6/tdf124586.py
+++ b/sw/qa/uitest/writer_tests6/tdf124586.py
@@ -15,7 +15,6 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf124586(UITestCase):
    def test_tdf124586_crash_switch_outline_numbering(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             #Goto Tools > Chapter Numbering.
             with 
self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as 
xDialog:
diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py 
b/sw/qa/uitest/writer_tests6/tdf125104.py
index 63dbda6a2bbb..6e87c2da12b5 100644
--- a/sw/qa/uitest/writer_tests6/tdf125104.py
+++ b/sw/qa/uitest/writer_tests6/tdf125104.py
@@ -10,7 +10,6 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import select_pos, get_state_as_dict
 from uitest.uihelper.common import select_by_text
-from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf125104(UITestCase):
 
diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py 
b/sw/qa/uitest/writer_tests6/tdf126017.py
index a57a25305d8a..ce19925d488e 100644
--- a/sw/qa/uitest/writer_tests6/tdf126017.py
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -15,7 +15,6 @@ from uitest.uihelper.common import get_url_for_data_file
 class tdf126017(UITestCase):
    def test_tdf126017_crash_after_undo(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as 
writer_doc:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
 
             #go to TOC
             with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", 
close_button="close") as xDialog:
diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py 
b/sw/qa/uitest/writer_tests6/tdf126168.py
index 2415351dbb63..16e5fc6fbc2c 100644
--- a/sw/qa/uitest/writer_tests6/tdf126168.py
+++ b/sw/qa/uitest/writer_tests6/tdf126168.py
@@ -15,8 +15,6 @@ class tdf126168(UITestCase):
 
    def test_tdf126168_frame_undo_redo_crash(self):
         with self.ui_test.create_doc_in_start_center("writer") as document:
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
 
             #2) Menu > Insert > Frame > Frame
             #3) Press OK in Frame dialog
diff --git a/sw/qa/uitest/writer_tests6/tdf126226.py 
b/sw/qa/uitest/writer_tests6/tdf126226.py
index 65da8b6d6e5d..823b0b137721 100644
--- a/sw/qa/uitest/writer_tests6/tdf126226.py
+++ b/sw/qa/uitest/writer_tests6/tdf126226.py
@@ -13,7 +13,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class Tdf126226(UITestCase):
 
    def test_tdf126226(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf126226.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf126226.odt")):
 
             self.xUITest.executeCommand(".uno:SelectAll")
 
diff --git a/sw/qa/uitest/writer_tests6/tdf141957.py 
b/sw/qa/uitest/writer_tests6/tdf141957.py
index 66795099fcfb..fc1605aa24ef 100644
--- a/sw/qa/uitest/writer_tests6/tdf141957.py
+++ b/sw/qa/uitest/writer_tests6/tdf141957.py
@@ -15,7 +15,6 @@ class tdf141957(UITestCase):
     def test_tdf_141957(self):
         with self.ui_test.load_file(get_url_for_data_file("tdf141957.odt")):
             with 
self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
-                tabcontrol = xDialog.getChild("tabcontrol")
 
                 xLandscape = xDialog.getChild('radiobuttonLandscape')
                 self.assertEqual("true", 
get_state_as_dict(xLandscape)['Checked'])
diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py 
b/sw/qa/uitest/writer_tests7/tdf104795.py
index 98be1cf366b2..478a6d37260a 100644
--- a/sw/qa/uitest/writer_tests7/tdf104795.py
+++ b/sw/qa/uitest/writer_tests7/tdf104795.py
@@ -13,7 +13,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf104795(UITestCase):
 
    def test_tdf104795(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")):
             with 
self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as 
xDialog:
 
                 sShowSignedText = 
get_state_as_dict(xDialog.getChild('showsigned'))['Text']
diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py 
b/sw/qa/uitest/writer_tests7/tdf122780.py
index 957ef31dfd13..80fe6e442163 100644
--- a/sw/qa/uitest/writer_tests7/tdf122780.py
+++ b/sw/qa/uitest/writer_tests7/tdf122780.py
@@ -13,7 +13,7 @@ from uitest.uihelper.common import get_state_as_dict, 
get_url_for_data_file
 class tdf122780(UITestCase):
 
    def test_tdf122780(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) 
as writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")):
             with 
self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as 
xDialog:
 
                 # Without the fix in place, this test would have hung here
diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py 
b/sw/qa/uitest/writer_tests7/tdf133348.py
index 8f8ff94cf3b5..417dedeb6aa9 100644
--- a/sw/qa/uitest/writer_tests7/tdf133348.py
+++ b/sw/qa/uitest/writer_tests7/tdf133348.py
@@ -14,10 +14,6 @@ class tdf133348(UITestCase):
 
         with self.ui_test.create_doc_in_start_center("writer") as document:
 
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
-
-
             self.xUITest.executeCommand(".uno:SelectAll")
             xArgs = mkPropertyValues({"Text": "C1"})
             self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", 
xArgs)
@@ -33,7 +29,6 @@ class tdf133348(UITestCase):
                 actionProps = mkPropertyValues(props)
                 xFirstName.executeAction("TYPE", actionProps)
 
-            xWriterDoc = self.xUITest.getTopFocusWindow()
             xArgs = mkPropertyValues({"Text": "C2"})
             self.xUITest.executeCommandWithParameters(".uno:ReplyComment", 
xArgs)
 
diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py 
b/sw/qa/uitest/writer_tests7/tdf134243.py
index 9200a4ba81de..df6c2abf77c2 100644
--- a/sw/qa/uitest/writer_tests7/tdf134243.py
+++ b/sw/qa/uitest/writer_tests7/tdf134243.py
@@ -12,7 +12,7 @@ from uitest.uihelper.common import get_url_for_data_file
 class tdf134243(UITestCase):
 
     def test_tdf134243(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as 
writer_doc:
+        with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")):
 
             # Without the fix in place, it would hung launching the mailmerge 
wizard
             with 
self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard", 
close_button="cancel"):
diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py 
b/sw/qa/uitest/writer_tests7/tdf140117.py
index 42b8b04fa3fd..835d99219fae 100644
--- a/sw/qa/uitest/writer_tests7/tdf140117.py
+++ b/sw/qa/uitest/writer_tests7/tdf140117.py
@@ -26,7 +26,6 @@ class tdf140117(UITestCase):
 
                     xPageSytle = document.getStyleFamilies().getByIndex(2)
                     xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
-                    xHeaderFirstText = 
xPageSytle.getByIndex(0).HeaderTextFirst.String
                     xHeaderLeftText = 
xPageSytle.getByIndex(0).HeaderTextLeft.String
                     xHeaderRightText = 
xPageSytle.getByIndex(0).HeaderTextRight.String
 
diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py 
b/sw/qa/uitest/writer_tests7/tdf141158.py
index 6cdf178da03d..8691d801ebc9 100644
--- a/sw/qa/uitest/writer_tests7/tdf141158.py
+++ b/sw/qa/uitest/writer_tests7/tdf141158.py
@@ -9,7 +9,6 @@
 
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_pos
 from uitest.uihelper.common import get_url_for_data_file
 
@@ -32,7 +31,6 @@ class TestTdf141158(UITestCase):
             self.xUITest.executeCommand(".uno:JumpToHeader")
             # get the text of the header
             xPageSytle = document.getStyleFamilies().getByIndex(2)
-            xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
             xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
             # without the fix in place it was "Right Header" (lost hidden left 
header),
             # with the fix it should pass...
diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py 
b/sw/qa/uitest/writer_tests7/tdf141557.py
index 355a9f3662ff..50c12949c040 100644
--- a/sw/qa/uitest/writer_tests7/tdf141557.py
+++ b/sw/qa/uitest/writer_tests7/tdf141557.py
@@ -8,15 +8,12 @@
 #
 from uitest.framework import UITestCase
 from com.sun.star.text.TextContentAnchorType import AS_CHARACTER, AT_PARAGRAPH
-import org.libreoffice.unotest
 from uitest.uihelper.common import get_url_for_data_file
 
 class tdf141557(UITestCase):
     def test_tdf141557(self):
         # load the sample file
         with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")

... etc. - the rest is truncated

Reply via email to